a
    |Ä#dª  ã                   @   sŒ   d Z ddlZddlZddlmZmZmZ ddlmZ ddl	m
Z
 dee eeeee d	œd
d„Zdeee  ddœdd„Zedkrˆeƒ  dS )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)ÚIterableÚListÚOptionalé   )Ú__version__)ÚUniversalDetectorÚstdinF)ÚlinesÚnameÚminimalÚshould_rename_legacyÚreturnc                 C   sx   t |d�}| D ] }t|ƒ}| |¡ |jr q0q| ¡  |j}|rJ|d S |d rn|› d|d › d|d › �S |› d�S )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   Ú	bytearrayÚfeedÚdoneÚcloseÚresult)r	   r
   r   r   ÚuÚliner   © r   úY/var/www/html/gsl.tools/lib/python3.9/site-packages/pip/_vendor/chardet/cli/chardetect.pyÚdescription_of   s    

r   )Úargvr   c                 C   s®   t jdd�}|jddt  d¡dtjjgd� |jdd	d
d� |jdddd
d� |jdddt› �d� | | ¡}|j	D ]4}| 
¡ rŽtdtjd� tt||j|j|jd�ƒ qtdS )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)ÚdescriptionÚinputz@File whose encoding we would like to determine. (default: stdin)ÚrbÚ*)ÚhelpÚtypeÚnargsÚdefaultz	--minimalz*Print only the encoding to standard outputÚ
store_true)r   Úactionz-lz--legacyz,Rename legacy encodings to more modern ones.z	--versionÚversionz	%(prog)s )r$   r%   z£You 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)ÚargparseÚArgumentParserÚadd_argumentÚFileTypeÚsysr   Úbufferr   Ú
parse_argsr   ÚisattyÚprintÚstderrr   r
   r   Úlegacy)r   ÚparserÚargsÚfr   r   r   Úmain:   sH    	þûýüÿ

ûÿÿr5   Ú__main__)r   FF)N)Ú__doc__r'   r+   Útypingr   r   r   Ú r   Úuniversaldetectorr   ÚbytesÚstrÚboolr   r5   Ú__name__r   r   r   r   Ú<module>   s$      üû"5