a
    `'                     @   sZ   d Z ddlZddlZddlmZ ddlmZ ddlmZ dd ZG dd	 d	Z	d
d Z
dS )z=Contains the logic for all of the default options for Flake8.    N)defaults)debug)vcsc                 C   sV   | j }|dddddd |ddd	d
 |dddd |dddd
 |ddddd dS )zRegister the preliminary options on our OptionManager.

    The preliminary options include:

    - ``-v``/``--verbose``
    - ``--output-file``
    - ``--append-config``
    - ``--config``
    - ``--isolated``
    z-vz	--verboser   countzPrint more information about what is happening in flake8. This option is repeatable and will increase verbosity each time it is repeated.defaultactionhelpz--output-fileNzRedirect report to a file.r   r	   z--append-configappendzProvide extra config files to parse in addition to the files found by Flake8 by default. These files are the last ones read and so they take the highest precedence when multiple files provide the same option.r   r	   z--configzPath to the config file that will be the authoritative config source. This will cause Flake8 to ignore all other configuration files.z
--isolatedF
store_truezIgnore all configuration files.)add_argument)parserr    r   2lib/python3.9/site-packages/flake8/main/options.pyregister_preliminary_options
   s6    
	r   c                   @   s    e Zd ZdZdd Zdd ZdS )JobsArgumentz&Type callback for the --jobs argument.c                 C   sD   d| _ d| _|dkrd| _ n$| r0t|| _ntd|dS )zParse and validate the --jobs argument.

        :param str arg:
            The argument passed by argparse for validation
        FautoTz"{!r} must be 'auto' or an integer.N)is_auton_jobsisdigitintargparseArgumentTypeErrorformat)selfargr   r   r   __init__D   s    zJobsArgument.__init__c                 C   s   | j r
dS t| jS )zFormat our JobsArgument class.r   )r   strr   )r   r   r   r   __str__U   s    zJobsArgument.__str__N)__name__
__module____qualname____doc__r   r!   r   r   r   r   r   A   s   r   c              	   C   s  | j }|ddddddd |dd	dd
d |dd	dd |dddtjddddd |dddddddd |ddddddd |dddd |d d!d"dd#d$ |d%d	dd&d |d'd(dtjddd)d |d*d(dddd+d |d,ddd-d. |d/td0tjdd1d2 |d3td0d4dd5d2 |d6td0tjdd7d2 |d8d(dtjddd9d |d:d;dd	d<d= |d>d	dd?d |d@dAdBd;dCdD |dEd	ddFd |dGddddHdI |dJd	dKd |dLt	j
t	 dMdN |dOdPdQdtdRdS |dTd;dd	dUd= |dVd;d	dWdX |dYtjtj| dZdd[d\ d4S )]a  Register the default options on our OptionManager.

    The default options include:

    - ``-q``/``--quiet``
    - ``--count``
    - ``--diff``
    - ``--exclude``
    - ``--extend-exclude``
    - ``--filename``
    - ``--format``
    - ``--hang-closing``
    - ``--ignore``
    - ``--extend-ignore``
    - ``--per-file-ignores``
    - ``--max-line-length``
    - ``--max-doc-length``
    - ``--indent-size``
    - ``--select``
    - ``--disable-noqa``
    - ``--show-source``
    - ``--statistics``
    - ``--enable-extensions``
    - ``--exit-zero``
    - ``-j``/``--jobs``
    - ``--tee``
    - ``--benchmark``
    - ``--bug-report``
    z-qz--quietr   r   Tz>Report only file names, or nothing. This option is repeatable.)r   r   parse_from_configr	   z--countr   zmPrint total number of errors and warnings to standard error and set the exit code to 1 if total is not empty.)r   r&   r	   z--diffzfReport changes only within line number ranges in the unified diff provided on standard in by the user.r   z	--excludepatterns,zOComma-separated list of files or directories to exclude. (Default: %(default)s))metavarr   comma_separated_listr&   normalize_pathsr	   z--extend-exclude zQComma-separated list of files or directories to add to the list of excluded ones.)r)   r   r&   r*   r+   r	   z
--filenamez*.pyzcOnly check for filenames matching the patterns in this comma-separated list. (Default: %(default)s))r)   r   r&   r*   r	   z--stdin-display-namestdinzThe name used when reporting errors from code passed via stdin. This is useful for editors piping the file contents to flake8. (Default: %(default)s)r
   z--formatr   r   z0Format errors according to the chosen formatter.)r)   r   r&   r	   z--hang-closingzOHang closing bracket instead of matching indentation of opening bracket's line.z--ignoreerrorsz~Comma-separated list of errors and warnings to ignore (or skip). For example, ``--ignore=E4,E51,W234``. (Default: %(default)s)z--extend-ignorez}Comma-separated list of errors and warnings to add to the list of ignored ones. For example, ``--extend-ignore=E4,E51,W234``.z--per-file-ignoresa  A pairing of filenames and violation codes that defines which violations to ignore in a particular file. The filenames can be specified in a manner similar to the ``--exclude`` option and the violations work similarly to the ``--ignore`` and ``--select`` options.)r   r&   r	   z--max-line-lengthnzPMaximum allowed line length for the entirety of this run. (Default: %(default)s))typer)   r   r&   r	   z--max-doc-lengthNzTMaximum allowed doc line length for the entirety of this run. (Default: %(default)s)z--indent-sizez9Number of spaces used for indentation (Default: %default)z--selectztComma-separated list of errors and warnings to enable. For example, ``--select=E4,E51,W234``. (Default: %(default)s)z--disable-noqaFzZDisable the effect of "# noqa". This will report errors on lines with "# noqa" at the end.)r   r&   r   r	   z--show-sourcez/Show the source generate each error or warning.z--no-show-sourcestore_falseZshow_sourcezNegate --show-source)r   destr&   r	   z--statisticszCount errors and warnings.z--enable-extensionszDEnable plugins and extensions that are otherwise disabled by default)r   r&   r*   r	   z--exit-zeroz3Exit with status code "0" even if there are errors.z--install-hookzVInstall a hook that is run prior to a commit for the supported version control system.)r   choicesr	   z-jz--jobsr   zNumber of subprocesses to use to run checks in parallel. This is ignored on Windows. The default, "auto", will auto-detect the number of processors available to use. (Default: %(default)s))r   r&   r0   r	   z--teez Write to stdout and output-file.z--benchmarkz4Print benchmark information about this run of Flake8r   z--bug-report)option_managerz7Print information necessary when preparing a bug report)r   nargsr	   )
add_optionjoinr   ZEXCLUDEZIGNOREr   ZMAX_LINE_LENGTHZINDENT_SIZEZSELECTr   ZInstallActionr3   r   	functoolspartialr   ZDebugAction)r4   r6   r   r   r   register_default_optionsZ   s~   	





		

	
	r:   )r%   r   r8   Zflake8r   Zflake8.mainr   r   r   r   r:   r   r   r   r   <module>   s   7