ʺh$ddlZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z ddlmZdd ed ed efd Zdde ed efdZedkr edSdS)N)dumps)abspath)python_version)List)from_fp)CliDetectionResult) __version__yesquestiondefaultreturncbdddddd}|d}n$|dkrd}n|dkrd }ntd |z tj||zt }||d kr||S||vr||Stjd ~) aAsk a yes/no question via input() and return their answer. "question" is a string that is presented to the user. "default" is the presumed answer if the user just hits . It must be "yes" (the default), "no" or None (meaning an answer is required of the user). The "answer" return value is True for "yes" or False for "no". Credit goes to (c) https://stackoverflow.com/questions/3041986/apt-command-line-interface-like-yes-no-input TF)r yyenonNz [y/n] r z [Y/n] rz [y/N] zinvalid default answer: '%s'z3Please respond with 'yes' or 'no' (or 'y' or 'n'). ) ValueErrorsysstdoutwriteinputlower)r r validpromptchoices /builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/charset_normalizer/cli/normalizer.py query_yes_nor st4u5 I IE E   D7'ABBBX F*+++  6R<<> ! u__= J  V W W WXargvc  tjd}|dtjddd|dd d d d d |ddd d dd|ddd d dd|ddd d dd|ddd d dd|dd d d d!d"|d#d$d%d&td'd()|d*d+d,t td-.||}|j d/ur&|j d urtd0tj 1d2S|jd/ur&|j d urtd3tj 1d2S|jd4ks |jd5krtd6tj 1d2Sg}|jD] t# |j|j7}|td9 j|jd5krd:nd;tj 1|t-t/ jd8ggd jD j j j j jd8d {|j d/urj"d?d/urRtd@ jtj 1 j#d ur $7 j%dA}|j d ur9|&dBj j#d ur $nR|jd urItOdC jdDd ur j#d ur $ t/dEdA(||dF_)tU|dFj)dGdHI5}|+tYd8d8d8n #1swxYwYn^#tZ$rQ}ttY|tj 1 j#d ur $Yd8}~dJSd8}~wwxYw j#d ur $|j.d urJtt_tA|d2kr dK|Dn |dFj0d/dLMn8|jD]0 tdN( fdO|D1dFS)Pz 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.) descriptionfilesrb+zFile(s) to be analysed)typenargshelpz-vz --verbose store_trueFverbosezjDisplay complementary information about file if any. Stdout will contain logs about the detection process.)actionr destr(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 --minimalminimalzBOnly output the charset detected to STDOUT. Disabling JSON output.z-rz --replacereplacezGReplace file when trying to normalize it instead of creating a new one.z-fz--forceforcezHReplace file without asking if you are sure, use this flag with caution.z-tz --thresholdstoreg? thresholdzUDefine a custom maximum amount of chaos allowed in decoded content. 0. <= chaos <= 1.)r+r r&r,r(z --versionversionz!Charset-Normalizer {} - Python {}z"Show version information and exit.)r+r4r(Tz.Use --replace in addition of --normalize only.)filez*Use --force in addition of --replace only.gg?z---threshold VALUE should be between 0. AND 1.)r3explainNz4Unable to identify originating encoding for "{}". {}z-Maybe try increasing maximum amount of chaos.rUnknownc*g|]}|jk |Sencoding).0cp best_guesss r zcli_detect..s1!444444rc*g|]}|jk |Sr:r;)r=r>els rr@zcli_detect..s0!"!"!"(*')R['8'8%''8'8'8rutfzJ"{}" file does not need to be normalized, as it already came from unicode..z0Are you sure to normalize "{}" by replacing it ?rz./{}rwzutf-8r;cg|] }|j Sr:)__dict__)r=rBs rr@zcli_detect.. s******r) ensure_asciiindentz, c\g|](}|jtjk|jpd)S) undefined)pathrnamer<)r=rBmy_files rr@zcli_detect..sA7ggl&;&;;; 2{;;;r)1argparseArgumentParser add_argumentFileTypefloatformatr r parse_argsr0r.printrstderrr1r3r#rr*bestrPappendrrr<encoding_aliasescould_be_from_charsetlanguage alphabetsbom percent_chaospercent_coherencelenr- startswithclosedclosesplitinsertrjoin unicode_pathopenrstrIOErrorr/rrI) r parserargsx_matcheso_fper?rBrQs @@@r cli_detectrv.s  $%F  h'--S?W   @     X     [     Q     V     W      d 3:: ))  2    T " "D |t% 7 7 >SZPPPPq zTdle33 :LLLLq ~t~33 =CJOOOOq B:xx'T^T\RRR\\^^   FMML~++DC  Z     II"GL))       II"GL))'/","B '(N,0   (7||aD$5!BZ'' . ' 5 5 " " 3!"!"!"!".0.F!"!"!" !# " " " 0 " 4 $ %(~%%&11%88D@@dkk#L!Z  ~.. \'',,<5((IIb*"5666~.. J%''$JQQ#L   ~..  )0sxx||1L1L)M)MBqE&be0#HHH2BZ111222222222222222#a&&sz2222~.. 111111  >U " " MMOOO |u .1"ggkk**r****r!u~!       z  G  "$     1s>AU27#U& U2&U* *U2-U* .U22 W rs# ######&&&&&&888888222222XX3XXXXXXBp p T#Yp #p p p p f zJLLLLLr