
    ޺i.                        S SK Jr  S SKrS SKrS SKrS SKJr  S SKJrJ	r	J
r
JrJr  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  S S	KJr  SSS
 jjr " S S5      rSSS jjr\S:X  a  \" 5         gg)    )annotationsN)dumps)abspathbasenamedirnamejoinrealpath)python_version)unidata_version)from_fp)CliDetectionResult)__version__c                    US:X  a  SOSn [        X-   5      R                  5       R                  5       nU(       d  US:H  $ US;   a  gUS;   a  g[        S5        MP  )	zBAsk a yes/no question via input() and return the answer as a bool.yesz [Y/n] z [y/N] T)yr   )nnoFzPlease respond with 'y' or 'n'.)inputstriplowerprint)questiondefaultpromptchoices       ^/var/www/piano.thomer.com/venv/lib/python3.13/site-packages/charset_normalizer/cli/__main__.pyquery_yes_nor      sd    !U*Y	F
x()//1779e##\![ /0     c                  P    \ rS rSrSr    S       S	S jjrS
S jrSS jrSrg)FileType    a  Factory for creating file object types

Instances of FileType are typically passed as type= arguments to the
ArgumentParser add_argument() method.

Keyword Arguments:
    - mode -- A string indicating how the file is to be opened. Accepts the
        same values as the builtin open() function.
    - bufsize -- The file's desired buffer size. Accepts the same values as
        the builtin open() function.
    - encoding -- The file's encoding. Accepts the same values as the
        builtin open() function.
    - errors -- A string indicating how encoding and decoding errors are to
        be handled. Accepts the same value as the builtin open() function.

Backported from CPython 3.12
Nc                4    Xl         X l        X0l        X@l        g N)_mode_bufsize	_encoding_errors)selfmodebufsizeencodingerrorss        r   __init__FileType.__init__3   s     
!r   c                P  ^  US:X  a  ST R                   ;   a:  ST R                   ;   a  [        R                  R                  $ [        R                  $ [	        U 4S jS 5       5      (       a:  ST R                   ;   a  [        R
                  R                  $ [        R
                  $ ST R                    3n[        U5      e [        UT R                   T R                  T R                  T R                  5      $ ! [         a#  nSU SU 3n[        R                  " U5      eS nAff = f)	N-rbc              3  @   >#    U  H  oTR                   ;   v   M     g 7fr#   )r$   ).0cr(   s     r   	<genexpr>$FileType.__call__.<locals>.<genexpr>D   s     4e$**_es   waxzargument "-" with mode zcan't open 'z': )r$   sysstdinbufferanystdout
ValueErroropenr%   r&   r'   OSErrorargparseArgumentTypeError)r(   stringmsgemessages   `    r   __call__FileType.__call__?   s    S=djj +.$**+<syy''K#))K4e444,/4::,=szz((M3::M/

|< o%	6

DMM4>>4<<XX 	6$VHCs3G,,W55	6s   6C8 8
D%D  D%c           
     `   U R                   U R                  4nSU R                  4SU R                  4/nSR	                  U Vs/ s H  o3S:w  d  M
  [        U5      PM     snU VVs/ s H  u  pCUc  M
  U SU< 3PM     snn-   5      n[        U 5      R                   SU S3$ s  snf s  snnf )Nr+   r,   , =())r$   r%   r&   r'   r   reprtype__name__)r(   argskwargsargkwargs_strs         r   __repr__FileType.__repr__Q   s    zz4==(t~~.4<<0HI99"&4$3)YT#Y$4.4Hf72"QsgfHI
 t*%%&az33 5Hs   	B%B%'	B*4B*)r%   r&   r'   r$   )r1   rK   NN)r)   strr*   intr+   
str | Noner,   r[   )rC   rY   returnz	typing.IO)r\   rY   )	rQ   
__module____qualname____firstlineno____doc__r-   rG   rW   __static_attributes__ r   r   r    r        sJ    ( #!

 
 	

 
6$4r   r    c                X   [         R                  " SS9nUR                  S[        S5      SSS9  UR                  SS	S
SSSS9  UR                  SSS
SSSS9  UR                  SSS
SSSS9  UR                  SSS
SSSS9  UR                  SSS
SSSS9  UR                  SS S
SS!S"S9  UR                  S#S$S
SS%S&S9  UR                  S'S(S)S*[        S+S,S-9  UR                  S.S/S0R                  [        [        5       [        [        R                  R                  5       R                  S15      (       a  S2OS35      S4S59  UR                  U 5      nUR                  S6L a\  UR                  SL aM  UR                   (       a#  UR                    H  nUR#                  5         M     [%        S7[&        R(                  S89  g9UR*                  S6L a\  UR                  SL aM  UR                   (       a#  UR                    H  nUR#                  5         M     [%        S:[&        R(                  S89  g9UR,                  S;:  d  UR,                  S<:  aM  UR                   (       a#  UR                    H  nUR#                  5         M     [%        S=[&        R(                  S89  g9/ nUR                    GH7  n[/        UUR,                  UR0                  UR2                  SL S>9nUR5                  5       nUc}  [%        S@R                  UR6                  UR,                  S<:  a  SAOSB5      [&        R(                  S89  UR9                  [;        [=        UR6                  5      S?/ / SC/ SS<S;S?S65      5        GOU[;        [=        UR6                  5      UR>                  UR@                  URB                   Vs/ s H  nXvR>                  :w  d  M  UPM     snURD                  URF                  URH                  URJ                  URL                  S?S65      nUR9                  U5        [O        U5      S9:  a  URP                  (       a  U H  n	X:w  d  M
  UR9                  [;        [=        UR6                  5      U	R>                  U	R@                  U	RB                   Vs/ s H  nXyR>                  :w  d  M  UPM     snU	RD                  U	RF                  U	RH                  U	RJ                  U	RL                  S?S5      5        M     UR                  S6L Ga  UR>                  RS                  SD5      S6L aS  [%        SER                  UR6                  5      [&        R(                  S89  URT                  SL a  UR#                  5         GM  [W        [Y        UR6                  5      5      n
[[        [Y        UR6                  5      5      nUR]                  SF5      nUR                  SL a<  UR_                  SGUR>                  5        URT                  SL a  UR#                  5         OYUR*                  SL aJ  [a        SHR                  UR6                  5      SI5      SL a"  URT                  SL a  UR#                  5         GM   [c        U
SFRc                  U5      5      Ul2        [g        URd                  SJ5       nURi                  URk                  5       5        S?S?S?5        URT                  SL d  GM'  UR#                  5         GM:     URp                  SL aM  [%        [s        [O        U5      S9:  a  U V	s/ s H  oRt                  PM     sn	OUSL   Rt                  S6SMSN95        gLUR                    Hf  n[%        SORc                  U V	s/ s H=  n	U	Rv                  [=        UR6                  5      :X  d  M(  U	R>                  =(       d    SPPM?     sn	5      5        Mh     gLs  snf s  snf ! , (       d  f       GN= f! [l         aK  n[%        [o        U5      [&        R(                  S89  URT                  SL a  UR#                  5          S?nA  gKS?nAff = fs  sn	f s  sn	f )Qzx
CLI assistant using ARGV and ArgumentParser
:param argv:
:return: 0 if everything is fine, anything else equal trouble
zvThe Real First Universal Charset Detector. Discover originating encoding used on text file. Normalize text to unicode.)descriptionfilesrb+zFile(s) to be analysed)rP   nargshelpz-vz	--verbose
store_trueFverbosezjDisplay complementary information about file if any. Stdout will contain logs about the detection process.)actionr   destri   z-az--with-alternativealternativeszIOutput complementary possibilities if any. Top-level JSON WILL be a list.z-nz--normalize	normalizezLPermit to normalize input file. If not set, program does not write anything.z-mz	--minimalminimalzBOnly output the charset detected to STDOUT. Disabling JSON output.z-rz	--replacereplacezGReplace file when trying to normalize it instead of creating a new one.z-fz--forceforcezHReplace file without asking if you are sure, use this flag with caution.z-iz--no-preemptiveno_preemptivez>Disable looking at a charset declaration to hint the detector.z-tz--thresholdstoreg?	thresholdzUDefine a custom maximum amount of noise allowed in decoded content. 0. <= noise <= 1.)rl   r   rP   rm   ri   z	--versionversionz;Charset-Normalizer {} - Python {} - Unicode {} - SpeedUp {}z.pyOFFONz"Show version information and exit.)rl   rv   ri   Tz.Use --replace in addition of --normalize only.)file   z*Use --force in addition of --replace only.g        g      ?z---threshold VALUE should be between 0. AND 1.)ru   explainpreemptive_behaviourNz4Unable to identify originating encoding for "{}". {}z-Maybe try increasing maximum amount of chaos. UnknownutfzJ"{}" file does not need to be normalized, as it already came from unicode..rK   z0Are you sure to normalize "{}" by replacing it ?r   wb   r      )ensure_asciiindentrJ   	undefined)<rA   ArgumentParseradd_argumentr    floatformatr   r
   r   	md_module__file__r   endswith
parse_argsrq   ro   re   closer   r9   stderrrr   ru   r   rk   rs   bestnameappendr   r   r+   encoding_aliasescould_be_from_charsetlanguage	alphabetsbompercent_chaospercent_coherencelenrn   
startswithclosedr   r	   r   splitinsertr   r   unicode_pathr?   writeoutputr@   rY   rp   r   __dict__path)argvparserrR   my_filex_matches
best_guesscp
cli_resulteldir_path	file_nameo_fprE   s                  r   
cli_detectr   [   sj    $$%F htnC6N   @   X   [   Q   V   W   M   d   MTT''--/88??ET	
 2  
 T"D||t% 7:::: &>SZZPzzTdlle3:::: &:L~~t~~3:::: &=CJJO	B::nnLL!%!3!3u!<	
 \\^
FMMLL  >>C/ H ZZ
 II"GLL)  ,%##++ )>>>000 >
 ##$$((,,J" IIj!7|aD$5$5!B'		. ' 5 " " 3 3 /1.F.F!".F')[['8 %'.F!"
 !# " " " 0 0 " 4 4 $ % ", ~~%&&11%8D@dkk#LL !ZZ	 ~~."8GLL#9:$Xgll%;<	 ) 4<<5(IIb*"5"56~~.JJ%'$JQQ#LL 	  ~~.	.28SXXb\.JJ+j55t<!2!2!45 = >>U"MMO B ||u.1"gkr*rr*r!u~~!	
&  zzG		 #%"$B77ggll&;; 32{2"$ " W.!"j =< #a&szz2~~.	 +sa   ^.3^.>^3^36_
 ^8,_
`"'`'`'8
_	_
_


`A ``__main__)r   )r   rY   r   rY   r\   boolr#   )r   zlist[str] | Noner\   rZ   )
__future__r   rA   r9   typingjsonr   os.pathr   r   r   r   r	   platformr
   unicodedatar   charset_normalizer.mdmdr   charset_normalizerr   charset_normalizer.modelsr   charset_normalizer.versionr   r   r    r   rQ   rb   r   r   <module>r      sW    "  
   > > # ' ) & 8 2184 84vK\ zL r   