bg dZddlZddlZddlmZmZmZddlmZddl m Z  dd ee d e d e d e d ee f dZddeee d dfdZedkr edSdS)a Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. N)IterableListOptional) __version__)UniversalDetectorstdinFlinesnameminimalshould_rename_legacyreturnct|}|D]/}t|}|||jrn0||j}|r|dS|dr|d|dd|dS|dS)a Return a string describing the probable encoding of a file or list of strings. :param lines: The lines to get the encoding of. :type lines: Iterable of bytes :param name: Name of file or collection of lines :type name: str :param should_rename_legacy: Should we rename legacy encodings to their more modern equivalents? :type should_rename_legacy: ``bool`` )r encodingz: z with confidence confidencez : no result)r bytearrayfeeddonecloseresult)r r r r uliners g/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/chardet/cli/chardetect.pydescription_ofrs$ /CDDDA t 6  E GGIII XF"j!! jVUU&,UUvl?SUUU   argvc Dtjd}|ddtjddtjjg|dd d |d d dd |dddt||}|j D]`}| rtdtj tt||j|j|jadS)z Handles command line arguments and gets things started. :param argv: List of arguments, as if specified on the command-line. If None, ``sys.argv[1:]`` is used instead. :type argv: list of str zATakes one or more file paths and reports their detected encodings) descriptioninputz@File whose encoding we would like to determine. (default: stdin)rb*)helptypenargsdefaultz --minimalz*Print only the encoding to standard output store_true)r"actionz-lz--legacyz,Rename legacy encodings to more modern ones.z --versionversionz %(prog)s )r'r(zYou are running chardetect interactively. Press CTRL-D twice at the start of a blank line to signal the end of your input. If you want help, run chardetect --help )file)r r N)argparseArgumentParser add_argumentFileTypesysr bufferr parse_argsrisattyprintstderrrr r legacy)rparserargsfs rmainr8:s~ $ OF   O  t $ $!"   9    ;   I/H;/H/H   T " "D Z    88::  Z       164rCs   ++++++++++111111 !&   E?     c]     D2 2 xS "2 d2 2 2 2 j zDFFFFFr