B
    .d2                 @   sB   d Z ddlZddlZdd Zdd Zdd Zd	d
 ZdddZdS )zFProvide a CLI to allow configuring developer settings, including mypy.    Nc              C   s   ddl } td| j dS )z)Print the current version of the package.r   NzQtPy version)qtpyprint__version__)r    r   U/work/yifan.wang/ringdown/master-ringdown-env/lib/python3.7/site-packages/qtpy/cli.pyprint_version   s    r   c                 sF   ddd ddl fddjD } d fd	d
|  D }|S )z>Generate a string with always-true/false args to pass to mypy.z--always-falsez--always-true)FTr   Nc                s   i | ]} j |k|qS r   )ZAPI).0name)r   r   r   
<dictcomp>   s    z&generate_mypy_args.<locals>.<dictcomp> c             3   s(   | ] \}} |  d |   V  qdS )=N)upper)r   r	   Z	is_active)optionsr   r   	<genexpr>   s   z%generate_mypy_args.<locals>.<genexpr>)r   Z	API_NAMESjoinitems)Zapis_activeZ	mypy_argsr   )r   r   r   generate_mypy_args   s    

r   c               C   s   t t  dS )z(Print the generated mypy args to stdout.N)r   r   r   r   r   r   print_mypy_args#   s    r   c              C   sh   t jdd} | j| jd | jdddtdd | jd	d
dd}|jddt jt	
dd}|jtd | S )z6Generate the argument parser for the dev CLI for QtPy.z*Features to support development with QtPy.)description)funcz	--versionstore_constr   z*If passed, will print the version and exit)actiondestconsthelpZSubcommandszSubcommand to runZ
Subcommand)titler   metavarz	mypy-argsz9Generate command line arguments for using mypy with QtPy.a  
            Generate command line arguments for using mypy with QtPy.

            This will generate strings similar to the following
            which help guide mypy through which library QtPy would have used
            so that mypy can get the proper underlying type hints.

                --always-false=PYQT5 --always-false=PYQT6 --always-true=PYSIDE2 --always-false=PYSIDE6

            It can be used as follows on Bash or a similar shell:

                mypy --package mypackage $(qtpy mypy-args)
            )r	   r   formatter_classr   )argparseArgumentParserset_defaults
print_helpadd_argumentr   add_subparsers
add_parserRawTextHelpFormattertextwrapdedentr   )parserZcli_subparsersZmypy_args_parserr   r   r   generate_arg_parser(   s     
r)   c                sB   t  }|j| d}dh  fddt| D }|jf | dS )z!Run the development CLI for QtPy.)argsr   c                s   i | ]\}}| kr||qS r   r   )r   keyvalue)reserved_paramsr   r   r
   V   s    zmain.<locals>.<dictcomp>N)r)   
parse_argsvarsr   r   )r*   r(   Zparsed_argsZcleaned_argsr   )r-   r   mainP   s
    r0   )N)__doc__r   r&   r   r   r   r)   r0   r   r   r   r   <module>   s   (