R`i d Z ddlZddlZddlmZmZmZ ddlmZ ddl m Z ddee ded e d e dee f dZdd eee ddfdZedk( r e yy)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__)UniversalDetectorlinesnameminimalshould_rename_legacyreturnc t | }| D ], }t | }|j | |j s, n |j |j }|r|d S |d r| d|d d|d S | 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 uliner s /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_vendor/chardet/cli/chardetect.pydescription_ofr s $ /CDA t66 GGI XXFj!! jr&,-->vl?S>TUUV; argvc B t j d }|j ddt j d dt j j g |j dd d |j dd dd |j dddt |j | }|j D ]c }|j rt dt j t t ||j |j |j e y)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&