o
    tBh	                    @  st  U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	m
Z
 ddlmZmZmZmZmZmZ ddlmZ ddlZddlZddlZddlZddlZddlmZ ddlmZmZ dd	lmZm Z  dd
l!m"Z"m#Z#m$Z$m%Z%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJ ddlKmLZM ddlNmOZOmPZPmQZQ ddlRmSZS ddlTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\ ddlm]Z]m^Z^m_Z_ ddl`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZk ddllmmZm dZndeod< g dZpdeod< g dZqdeod< h dZrdeod< h dZsdeod< h dZtdeod < G d!d" d"ZLG d#d$ d$Zud%Zvdeod%< d&Zwdeod&< d'Zxdeod'< d(Zydeod(< d)Zzdeod)< d*Z{deod*< d+Z|deod,< G d-d. d.eiZ}G d/d0 d0eme~ ZG d1d2 d2Zdd7d8ZG d9d: d:ejjZdd;d<ZG d=d> d>ejjZG d?d@ d@ejjZddCdDZG dEdF dFejjZddJdKZddOdPZddSdTZddWdXZddYdZZdd_d`ZddedfZddhdiZddmdnZddrdsZddudvZddydzZdd}d~Z			ddddZdddZdddZdZdZdddZddddZedkr8e  dS dS )a(  Generator of dynamically typed draft stubs for arbitrary modules.

The logic of this script can be split in three steps:
* parsing options and finding sources:
  - use runtime imports be default (to find also C modules)
  - or use mypy's mechanisms, if importing is prohibited
* (optionally) semantically analysing the sources using mypy (as a single set)
* emitting the stubs text:
  - for Python modules: from ASTs using StubGenerator
  - for C modules using runtime introspection and (optionally) Sphinx docs

During first and third steps some problematic files can be skipped, but any
blocking error during second step will cause the whole program to stop.

Basic usage:

  $ stubgen foo.py bar.py some_directory
  => Generate out/foo.pyi, out/bar.pyi, and stubs for some_directory (recursively).

  $ stubgen -m urllib.parse
  => Generate out/urllib/parse.pyi.

  $ stubgen -p urllib
  => Generate stubs for whole urlib package (recursively).

For C modules, you can get more precise function signatures by parsing .rst (Sphinx)
documentation for extra information. For this, use the --doc-dir option:

  $ stubgen --doc-dir <DIR>/Python-3.4.2/Doc/library -m curses

Note: The generated stubs should be verified manually.

TODO:
 - maybe use .rst docs also for Python modules
 - maybe export more imported names if there is no __all__ (this affects ssl.SSLError, for example)
   - a quick and dirty heuristic would be to turn this on if a module has something like
     'from x import y as _y'
 - we don't seem to always detect properties ('closed' in 'io', for example)
    )annotationsN)defaultdict)DictIterableListMappingOptionalcast)Final)build)CompileErrorErrors)InvalidSourceListcreate_source_list)BuildSourceFindModuleCacheModuleNotFoundReasonSearchPathsdefault_lib_path)ModuleInspect)!	ARG_NAMEDARG_POSARG_STAR	ARG_STAR2IS_ABSTRACTAssignmentStmtBlock	BytesExprCallExprClassDefComparisonExpr	DecoratorEllipsisExpr
Expression	FloatExprFuncBaseFuncDefIfStmtImport	ImportAll
ImportFrom	IndexExprIntExprListExpr
MemberExprMypyFileNameExprOverloadedFuncDef	StatementStrExpr	TupleExprTypeInfo	UnaryExpr)Options)Sigfind_unique_signaturesparse_all_signatures)generate_stub_for_c_module)
CantImportcommon_dir_prefixfail_missingfind_module_path_and_all_py3generate_guardedremove_misplaced_type_commentsreport_missingwalk_packages)all_yield_expressionshas_return_statementhas_yield_expression)OVERLOAD_NAMESAnyTypeCallableTypeInstanceNoneType	TupleTypeTypeTypeListTypeStrVisitorUnboundTypeget_proper_type)NodeVisitor)typingtyping_extensionsr
   TYPING_MODULE_NAMES)packagesvendorvendored_vendor_vendored_packagesVENDOR_PACKAGES)z/six.py
z
/vendored/z/vendor/z	/_vendor/z/_vendored_packages/	BLACKLIST>   pyasn1_modules.rfc2437.univpyasn1_modules.rfc2459.charpyasn1_modules.rfc2459.univEXTRA_EXPORTED>   __all____str____uri____repr__	__about__	__email__	__slots__	__title__
__author____license____summary____version____getstate____setstate____copyright__IGNORED_DUNDERS>   __eq____ge____gt____le____lt____ne____hash____iter__METHODS_WITH_RETURN_VALUEc                   @  s   e Zd ZdZdddZdS )r7   zPRepresents stubgen options.

    This class is mutable to simplify testing.
    	pyversiontuple[int, int]	no_importbooldoc_dirstrsearch_path	list[str]interpreter
parse_onlyignore_errorsinclude_private
output_dirmodulesrV   filesverbosequietexport_lessreturnNonec                 C  sd   || _ || _|| _|| _|| _|| _|| _|| _|| _|	| _	|
| _
|| _|| _|| _|| _|| _d S N)rz   r|   r~   r   r   decointerpreterr   r   r   r   r   rV   r   r   r   r   )selfrz   r|   r~   r   r   r   r   r   r   r   rV   r   r   r   r    r   c/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/mypy/stubgen.py__init__   s    
zOptions.__init__N) rz   r{   r|   r}   r~   r   r   r   r   r   r   r}   r   r}   r   r}   r   r   r   r   rV   r   r   r   r   r}   r   r}   r   r}   r   r   )__name__
__module____qualname____doc__r   r   r   r   r   r7      s    r7   c                   @  s:   e Zd ZdZ	ddddZedddZedddZdS )
StubSourcezA single source for stub: can be a Python or C module.

    A simple extension of BuildSource that also carries the AST and
    the value of __all__ detected at runtime.
    Nmoduler   path
str | Noneruntime_alllist[str] | Noner   r   c                 C  s   t ||d | _|| _d | _d S r   )r   sourcer   ast)r   r   r   r   r   r   r   r      s   
zStubSource.__init__c                 C     | j jS r   )r   r   r   r   r   r   r         zStubSource.modulec                 C  r   r   )r   r   r   r   r   r   r      r   zStubSource.path)NN)r   r   r   r   r   r   r   r   r   r   )r   r   )r   r   r   r   r   propertyr   r   r   r   r   r   r      s    r   EMPTYFUNCCLASSEMPTY_CLASSVAR
NOT_IN_ALLz<ERROR>ERROR_MARKERc                      sX   e Zd ZdZd fddZd fddZdddZdddZdddZdddZ	  Z
S ) AnnotationPrintera  Visitor used to print existing annotations in a file.

    The main difference from TypeStrVisitor is a better treatment of
    unbound types.

    Notes:
    * This visitor doesn't add imports necessary for annotations, this is done separately
      by ImportTracker.
    * It can print all kinds of types, but the generated strings may not be valid (notably
      callable types) since it prints the same string that reveal_type() does.
    * For Instance types it prints the fully qualified names.
    stubgenStubGeneratorr   r   c                   s   t    || _d S r   )superr   r   r   r   	__class__r   r   r     s   

zAnnotationPrinter.__init__trH   r   c                   s   t  |}| jj| |S r   )r   	visit_anyr   import_trackerrequire_namer   r   sr   r   r   r      s   zAnnotationPrinter.visit_anyrP   c                 C  s6   |j }| jj| |jr|d| |j d7 }|S N[])namer   r   r   argsargs_strr   r   r   r   visit_unbound_type%  s
   z$AnnotationPrinter.visit_unbound_typerK   c                 C     dS Nr   r   r   r   r   r   r   visit_none_type,     z!AnnotationPrinter.visit_none_typerN   c                 C  s   d|  |j dS r   )list_stritemsr   r   r   r   visit_type_list/     z!AnnotationPrinter.visit_type_listr   Iterable[Type]c                 C  s\   ddg}g }|D ] }| | }t|tr#|j|v r#|d| d q|| qd|S )zConvert an array of arguments to strings and join the results with commas.

        The main difference from list_str is the preservation of quotes for string
        arguments
        zbuiltins.byteszbuiltins.str', )accept
isinstancerP   original_str_fallbackappendjoin)r   r   typesresargarg_strr   r   r   r   2  s   

zAnnotationPrinter.args_strr   r   r   r   )r   rH   r   r   )r   rP   r   r   )r   rK   r   r   )r   rN   r   r   )r   r   r   r   )r   r   r   r   r   r   r   r   r   r   __classcell__r   r   r   r   r     s    


r   c                      sr   e Zd ZdZd# fddZd$ddZd%ddZd&ddZd'ddZd(ddZ	d)ddZ
d*ddZd+d!d"Z  ZS ),AliasPrinterzVisitor used to collect type aliases _and_ type variable definitions.

    Visit r.h.s of the definition to get the string representation of type alias.
    r   r   r   r   c                   s   || _ t   d S r   )r   r   r   r   r   r   r   r   I  s   zAliasPrinter.__init__noder   r   c                 C  s   |j | }g }t|j|j|jD ]I\}}}|tkr#|||  q|tkr2|d||   q|t	krA|d||   q|t
krS|| d||   qtd| d| dd| dS )	N***=zUnknown argument kind z in call(r   ))calleer   zip	arg_namesr   	arg_kindsr   r   r   r   r   
ValueErrorr   )r   r   r   r   r   r   kindr   r   r   visit_call_exprM  s   zAliasPrinter.visit_call_exprr0   c                 C  s   | j j|j |jS r   )r   r   r   r   r   r   r   r   r   visit_name_expr_  s   zAliasPrinter.visit_name_expror.   c                 C  sX   |}d}t |trd|j | }|j}t |ts	t |tstS | jj|j |j| S )N .)	r   r.   r   exprr0   r   r   r   r   )r   r   r   trailerr   r   r   visit_member_exprc  s   



zAliasPrinter.visit_member_exprr3   c                 C  s
   t |jS r   )reprvaluer   r   r   r   visit_str_exprn     
zAliasPrinter.visit_str_exprr+   c                 C  s(   |j | }|j| }| d| dS r   )baser   index)r   r   r   r   r   r   r   visit_index_exprq  s   zAliasPrinter.visit_index_exprr4   c                   s   d  fdd|jD S )Nr   c                 3      | ]}|  V  qd S r   r   .0nr   r   r   	<genexpr>w      z0AliasPrinter.visit_tuple_expr.<locals>.<genexpr>r   r   r   r   r   r   visit_tuple_exprv     zAliasPrinter.visit_tuple_exprr-   c                   s"   dd  fdd|jD  dS )Nr   r   c                 3  r   r   r   r   r   r   r   r   z  r   z/AliasPrinter.visit_list_expr.<locals>.<genexpr>r   r   r   r   r   r   visit_list_expry     "zAliasPrinter.visit_list_exprr"   c                 C  r   )Nz...r   r   r   r   r   visit_ellipsis|  r   zAliasPrinter.visit_ellipsisr   )r   r   r   r   )r   r0   r   r   )r   r.   r   r   )r   r3   r   r   )r   r+   r   r   )r   r4   r   r   )r   r-   r   r   )r   r"   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   C  s    






r   c                   @  sN   e Zd ZdZdddZdd
dZddddZdddZdddZdddZ	dS )ImportTrackerz0Record necessary imports during stub generation.r   r   c                 C  s&   i | _ i | _i | _t | _t | _d S r   )
module_fordirect_importsreverse_aliassetrequired_names	reexportsr   r   r   r   r     s
   zImportTracker.__init__r   r   nameslist[tuple[str, str | None]]c                 C  sV   |D ]&\}}|r|| j |< || j|< n|| j |< | j|d  | j|p%|d  qd S r   )r  r  popr  )r   r   r  r   aliasr   r   r   add_import_from  s   

zImportTracker.add_import_fromNr  r   c                 C  s`   |rd | j |< || j|< d S |}|r.d | j |< || j|< | j|d  |dd }|sd S d S Nr   r   )r  r  r  r
  
rpartition)r   r   r  r   r   r   r   
add_import  s   


zImportTracker.add_importr   c                 C     | j |dd  d S r  )r  addsplitr   r   r   r   r   r     r   zImportTracker.require_namec                 C  s   |  | | j| dS )zMark a given non qualified name as needed in __all__.

        This means that in case it comes from a module, it should be
        imported with an alias even is the alias is the same as the name.
        N)r   r  r  r  r   r   r   reexport  s   
zImportTracker.reexportr   c              
   C  s4  g }t t}t| jD ]p}|| jvrq| j| }|dur@|| jv r,| j|  d| }n|| jv r8| d| }|| | q|| jv rW| j| }|d| d| d q|| jv rod|vsbJ |d| d| d q|d| j|  d qt|	 D ]\}}|d| dd
t| d q|S )	z@The list of required import lines (as strings with python code).Nz as zimport 
r   from z import r   )r   listsortedr  r  r  r  r   r  r   r   )r   result
module_mapr   mr   r   r  r   r   r   import_lines  s,   






$zImportTracker.import_linesr   r   )r   r   r  r	  r   r   r   )r   r   r  r   r   r   r   r   r   r   )r   r   )
r   r   r   r   r   r  r  r   r  r  r   r   r   r   r    s    



	r  filer/   r   set[str]c                 C     t  }| | |jS r   )DefinitionFinderr   r  r  finderr   r   r   find_defined_names     
r%  c                   @  s.   e Zd ZdZdddZddd	ZdddZdS )r"  z:Find names of things defined at the top level of a module.r   r   c                 C     t  | _d S r   )r  r  r   r   r   r   r        zDefinitionFinder.__init__r   r   c                 C     | j |j d S r   r  r  r   r   r   r   r   r   visit_class_def      z DefinitionFinder.visit_class_defr&   c                 C  r)  r   r*  r+  r   r   r   visit_func_def  r-  zDefinitionFinder.visit_func_defNr  r   r   r   r   )r   r&   r   r   )r   r   r   r   r   r,  r.  r   r   r   r   r"    s
    

r"  c                 C  r!  r   )ReferenceFinderr   refsr#  r   r   r   find_referenced_names	  r&  r2  c                      sl   e Zd ZdZdddZd  fdd	Zd!ddZd" fddZd#ddZd$ddZ	d%ddZ
d&ddZ  ZS )'r0  z1Find all name references (both local and global).r   r   c                 C  r'  r   )r  r1  r   r   r   r   r     r(  zReferenceFinder.__init__blockr   c                      |j st | d S d S r   is_unreachabler   visit_block)r   r3  r   r   r   r7       zReferenceFinder.visit_blocker0   c                 C  r)  r   )r1  r  r   )r   r9  r   r   r   r     s   zReferenceFinder.visit_name_exprr   rJ   c                   s   |  |jj t | d S r   )add_reftypefullnamer   visit_instancer   r   r   r   r=    s   zReferenceFinder.visit_instancerP   c                 C  s   |j r| |j  d S d S r   )r   r:  r   r   r   r   r   #  r8  z"ReferenceFinder.visit_unbound_typerL   c                 C  s   |j D ]}||  qd S r   )r   r   )r   r   itemr   r   r   visit_tuple_type'  s   
z ReferenceFinder.visit_tuple_typerI   c                 C  s&   |j D ]}||  q|j|  d S r   )	arg_typesr   ret_type)r   r   r   r   r   r   visit_callable_type,  s   
z#ReferenceFinder.visit_callable_typer<  r   c                 C  r  )Nr   )r1  r  r  )r   r<  r   r   r   r:  2  r   zReferenceFinder.add_refr  )r3  r   r   r   )r9  r0   r   r   )r   rJ   r   r   )r   rP   r   r   )r   rL   r   r   )r   rI   r   r   )r<  r   r   r   )r   r   r   r   r   r7  r   r=  r   r?  rB  r:  r   r   r   r   r   r0    s    




r0  c                      s  e Zd ZdZ			ddddZd fddZdddZ	ddddZdddZdddZ	dd!d"Z
dd%d&Zdd+d,Zdd.d/Zd fd1d2Zdd5d6Zd fd8d9Zdd;d<Zdd=d>ZddBdCZdddFdGZddHdIZd fdKdLZddNdOZddQdRZddTdUZ	VdddZd[Zdd]d^Zdd_d`ZddadbZddcddZddedfZddgdhZ ddjdkZ!ddndoZ"ddpdqZ#ddrdsZ$dddtduZ%ddvdwZ&	Ddddzd{Z'dd~dZ(dddZ)dddZ*dddZ+  Z,S )r   z#Generate stub text from a mypy AST.F_all_r   r   r}   analyzedr   r   r   c                 C  s   || _ g | _g | _g | _d| _g g| _t| _g | _|| _	t
 | _|| _|| _| jddg |p1dD ]}|tvr>| j| q2t | _t | _d S )Nr   rS   )
NamedTupleNr   )rD  _output_decorators_import_lines_indent_varsr   _state_toplevel_names_include_privater  r   rE  r   r  rp   r  r  defined_namesmethod_names)r   rD  r   rE  r   r   r   r   r   r   9  s&   zStubGenerator.__init__r   r/   c           	        s   |j  _|j _t| _t| _dgddgdgd}| D ]\}}|D ]}| jvr0d }nd| } j	|||fg q&q t
 |  fdd jpOg D }|rs jtkr^ d	  d
 t|D ]} d| d	 qgd S d S )N
IncompleteAnyTypeVar	Generator)	_typeshedrS   zcollections.abc_c                   s   g | ]	}| j vr|qS r   )rM  )r   r   r   r   r   
<listcomp>n      z1StubGenerator.visit_mypy_file.<locals>.<listcomp>r  z'# Names in __all__ with no definition:
z#   )r<  r   r   r%  rO  r2  referenced_namesr   r   r  r   visit_mypy_filerD  rL  r   r  r  )	r   r   known_importspkgimportsr   r  undefined_namesr   r   r   r   rZ  \  s2   





zStubGenerator.visit_mypy_filer1   c                 C  s   d}|j D ]<}t|tsq| |jj|jjrq| |\}}|s/| j|j||d |r.d}q|r=|r=| j|j||d q| 	  qdS )z6@property with setters and getters, or @overload chainF)is_abstractis_overloadTN)
r   r   r!   is_private_namefuncr   r<  process_decoratorr.  clear_decorators)r   r   overload_chainr>  r_  r`  r   r   r   visit_overloaded_func_defv  s    


z'StubGenerator.visit_overloaded_func_defr&   r_  r`  c                 C  s  |  |j|js| |js| |jr|s|   d S | js.| jtt	fvr.|j
s.| d |  sPt|}|D ]\}}|| jv rBq8| ||}|rO| | q8| jD ]}| | qS|   | | j |jridnd d|j d | |j g }	t|jD ]\}
}|j}|j}|j}t|jtr|jj|
 nd }|
dko|dk}|
dko|dk}d}|r|s|stt|tsd	| | }| rtd
d |	D s|	 d |j!r|s| "|j!dd}|dkrd}nd	| d}n|d7 }|| }n|t#krd| | }n|t$krd| | }n|| }|	 | qd }|jdkr@t|jtr@tt|jj%tr8d }n| |jj%}nwt|t&rU|j't(ksR|jt)v rUd }nbt*|r| +d d}d}d}t,|D ]#\}}|j-d ur| .|j-s| /d d}|r| /d d}qit0|r| /d d}| 1d}| d| d| d| d}n
t0|s|sd}d}|d urd| }| d2|	 | d| d t	| _d S )Nr  zasync r   zdef r   r   r   cls: c                 s  s    | ]}| d V  qdS )r   N)
startswith)r   r   r   r   r   r     r   z/StubGenerator.visit_func_def.<locals>.<genexpr>r   TFz=...z = ...r   r   rT  r   rQ  r   r   r   z -> r   z: ...
)3ra  r   r<  is_not_in_allis_recorded_namerd  rJ  rL  r   r   is_awaitable_coroutiner  is_top_levelfind_self_initializersrP  get_initrH  is_coroutinerecord_name	enumerate	argumentsvariabler   r   unanalyzed_typerI   r@  rQ   rH   print_annotationis_namedanyr   initializerget_str_type_of_noder   r   rA  r&   abstract_statusr   ry   rF   add_abc_importrD   r   is_none_expradd_typing_importrE   typing_namer   )r   r   r_  r`  
self_initsinitr   	init_coder   r   iarg_varr   r   annotated_typeis_self_arg
is_cls_arg
annotationtypenamer   retname
yield_name	send_namereturn_namer   in_assignmentgenerator_nameretfieldr   r   r   r.    s   





(













zStubGenerator.visit_func_defr   r#   c                 C  s   t |to	|jdkS r   )r   r0   r   )r   r   r   r   r   r}    r   zStubGenerator.is_none_exprr!   c                 C  s:   |  |jj|jjrd S | |\}}| j|j|d d S )N)r_  )ra  rb  r   r<  rc  r.  )r   r   r_  rV  r   r   r   visit_decorator  s   zStubGenerator.visit_decoratortuple[bool, bool]c                 C  sr   d}d}|j D ]-}t|tr| ||\}}|p|}|p|}qt|tr4| ||\}}|p/|}|p3|}q||fS )a  Process a series of decorators.

        Only preserve certain special decorators such as @abstractmethod.

        Return a pair of booleans:
        - True if any of the decorators makes a method abstract.
        - True if any of the decorators is typing.overload.
        F)original_decoratorsr   r0   process_name_expr_decoratorr.   process_member_expr_decorator)r   r   r_  r`  	decoratori_is_abstracti_is_overloadr   r   r   rc    s   	



zStubGenerator.process_decoratorr0   contextc                 C  s   d}d}|j }|dv r| | ||fS | jj|dv r)| |j|| ||fS | |dr@| | | j| d}||fS | |drV| d | d d}||fS | |t	rh| | | 
d d}||fS )	a  Process a function decorator of form @foo.

        Only preserve certain special decorators such as @abstractmethod.

        Return a pair of booleans:
        - True if the decorator makes a method abstract.
        - True if the decorator is typing.overload.
        F)r   staticmethodclassmethodasynciozasyncio.coroutinesr   zabc.abstractmethodTzabc.abstractpropertyr   overload)r   add_decoratorr   r  getadd_coroutine_decoratorrb  refers_to_fullnamer   rG   r~  )r   r   r  r_  r`  r   r   r   r   r    s0   	

	



z)StubGenerator.process_name_expr_decoratorr   r   r<  str | tuple[str, ...]c                   s^   t |trt fdd|D S |dd\}}jj |ko. |kp.jj |kS )Nc                 3  s    | ]	}  |V  qd S r   )r  )r   fnamer   r   r   r   r   =      z3StubGenerator.refers_to_fullname.<locals>.<genexpr>r      )r   tuplerx  rsplitr   r  r  r  )r   r   r<  r   shortr   r  r   r  ;  s   
z StubGenerator.refers_to_fullnamer.   c                 C  s(  d}d}|j dkrt|jtr| |jj  d ||fS t|jtrt|jj dks4| jj|jj dkrt|j dv rt|j dkrY| j|jj  | dd  | d		|jj d
 n| j|jj  | |jj  d|j   d}||fS |j dkrt|jt
r|jj dkrt|jjtr|jjj dks| jj|jjj dkr| |j|jjj  d|jjj  ||fS t|jtr|jj dv s| jj|jj dv r| |j|jj d |jj  ||fS t|jtr|jj tv s| jj|jj tv r|j dkr| j|jj  | |jj  d d}||fS )a  Process a function decorator of form @foo.bar.

        Only preserve certain special decorators such as @abstractmethod.

        Return a pair of booleans:
        - True if the decorator makes a method abstract.
        - True if the decorator is typing.overload.
        Fsetterz.setterabc)abstractmethodabstractpropertyr  z%sr   z{}.{}r  r   T	coroutine
coroutinesr  z.coroutines.coroutine)r  r   r  z
.coroutiner  z	.overload)r   r   r   r0   r  r   r  r  r   formatr.   r  rb  rU   )r   r   r  r_  r`  r   r   r   r  C  sd   3


#


z+StubGenerator.process_member_expr_decoratorr   c                   s
  t |jj| _d }| js| jtkrt| j}| 	d | 	| j d|j
  | |j
 | |}|r?|D ]}| j| q6t|jttfrW|jt| }|d|  n=| jr||jjr|d}|jjrq|dd|jj d7 }|| | d n| jr|jjr|d | jd	 | jd	 |r| 	d
d| d | 	d t| j}|  jd7  _| jg  t  | | jd d | _| j!  | jd |j
 t| j|kr| jt"kr|d urd| j|< | jd d d d | jd< t"| _nt#| _t$ | _d S )Nr  class z
metaclass=Protocolr   r   r   zmetaclass=abc.ABCMetar  r   r   z:
    rC  r    ...
)%find_method_namesdefsbodyrP  rJ  rL  r   lenrG  r  r   rq  get_base_typesr   r   r   	metaclassr0   r.   r   r   r   rE  infois_protocol	type_varsr   r~  r_  r  rK  r   r,  r
  r   r   r  )r   r   sep
base_typesr   metatype_strr   r   r   r   r,    sR   








zStubGenerator.visit_class_defcdefr   c                 C  s   g }|j D ]:}t|tr|jdkr||j qt|tr.t|j}|| d|j  qt|tr?t	| }||
| q|S )z%Get list of base classes for a class.objectr   )base_type_exprsr   r0   r   r   r.   get_qualified_namer   r+   r   r   )r   r  r  r   modnamepr   r   r   r    s   





zStubGenerator.get_base_typesr   c                   r4  r   r5  r+  r   r   r   r7    s   zStubGenerator.visit_blockr   c                 C  sn  g }|j D ]}t|tr"| |jr"t|jtsJ | ||j q|  rBt|trB| |j	sB|j
sB| |jrB| ||j qt|tsLt|trb|j}t|j
trZ|j
j}nd gt| }n|g}|j
g}d}d}t||D ]3\}}	t|tr| |j	|j|	}
|
rd}|s| js| jttfvrd|
 }
d}| |
 | |j	 qr|| qt|rt| _d S d S )NFTr  )lvaluesr   r0   is_namedtuplervaluer   process_namedtuplerm  ra  r   ru  is_alias_expressionprocess_typealiasr4   r-   r   rL   r  r   ro  rJ  rL  r   r   r  rq  r   all)r   r   foundllvaluer   r   r  foundr>  r  r  r   r   r   visit_assignment_stmt  sT   


	



z#StubGenerator.visit_assignment_stmtc                 C  s>   t |tsdS |j}t |tr|jdpt |to|jdkS )NF
namedtuple)r   r   r   r0   r   endswithr.   )r   r   r   r   r   r   r    s   
zStubGenerator.is_namedtupler  r  r   c                 C  s   | j tkr
| d t|jd tr|jd jdd }n1t|jd t	t
fr<ttt |jd j}dd |D }n| | j |j d | jd d S | jd	 | | j d
|j d t|dkro| d n| jd | d |D ]}| | j d| d q|t| _ d S )Nr  r  , c                 S     g | ]}|j qS r   )r   )r   r>  r   r   r   rW        z4StubGenerator.process_namedtuple.<locals>.<listcomp>z: IncompleterQ  rF  r  z(NamedTuple):r   r  r  z: Incomplete
)rL  r   r  r   r   r3   r   replacer  r-   r4   r	   r   r   rJ  r   r   r   r  r   )r   r  r  r   
list_itemsr>  r   r   r   r    s&   



z StubGenerator.process_namedtupleT	top_levelc                   sX  t |trt |jtr|jjdkrdS t |tr| S t |tr6|jdv r'dS |jdkr/| S  |j S t |trW jrW|rIt |j	t
ttfpNt |j	toV |j	j S t |trt |jtr |jjst |jtrt|jj}n|jg}|jjdkrt|dkr|\}}t |tr|g}nt |tr|j|g }ndS t fdd	|D S dS )
zReturn True for things that look like target for an alias.

        Used to know if assignments look like type aliases, function alias,
        or module alias.
        rS  TTrueFalseFr   Callable   c                 3  s    | ]
} j |d dV  qdS )F)r  N)r  )r   r  r   r   r   r   A  s    z4StubGenerator.is_alias_expression.<locals>.<genexpr>)r   r   r   r0   r   r"   ra  r.   rE  r   r&   r!   r/   r5   is_private_memberr<  r+   r   r   r4   r   r  r-   r  )r   r   r  indicesr   retr   r   r   r    sP   









z!StubGenerator.is_alias_expressionc                 C  sH   t | }| |j d|| d | |j | jd |j d S )Nz = r  rC  )r   r  r   r   rq  rK  r   )r   r  r  r  r   r   r   r  E  s   zStubGenerator.process_typealiasr'   c                   sh   |j d }t|tr,t|jd tr,t|jd tr,|jd jdkr,d|jd jv r,d S t 	| d S )Nr   r  r   __main__)
r   r   r    operandsr0   r3   r   r   r   visit_if_stmt)r   r   r   r   r   r   r  K  s   
zStubGenerator.visit_if_stmtr)   c                 C  s"   |  dd|j  |j d d S )Nr  r   z
 import *
)add_import_linerelativeidr+  r   r   r   visit_import_allX  r   zStubGenerator.visit_import_allr*   c                   s  t  }g }t|j|j\}} jr&tj j|| j	d\}}|s%|}n|}|dkr.d S |j
D ]\}}	|dkrB tdg q1d}
|	d u rV jrV jd | tv rVd}
 ||d | }|	d u rz| jvrz jrp|tv rz|sz|dt vrzd}
|dd	 }|	d u r js jr|tv r jr|s| jdd	 d
 jdd	  fv rd}
|
r j| |}	|||	f q1 jd| | |  jd dd |D  |D ]\}} |p| qֈ jr fdd|j
D }|| d S d S )Nz.__init__.py
__future__six)r  NFr   T)r  r  r   rV  rC  c                 s  s    | ]	\}}|p	|V  qd S r   r   r   r   r  r   r   r   r     r  z2StubGenerator.visit_import_from.<locals>.<genexpr>c                   s.   g | ]\}}| j v r|d u r|tvr|qS r   )rD  rp   r  r   r   r   rW    s
    z3StubGenerator.visit_import_from.<locals>.<listcomp>)r  translate_module_namer  r  r   mypyutilcorrect_relative_importr   r  r  visit_importr(   r`   ra  rY  rD  rp   rU   r  r   r   r  r   r  rK  extendrq  update)r   r   exported_namesimport_namesr   r  full_moduleokr   as_nameexported
is_privater  r  r  r   r   r   visit_import_from[  sr    
(
zStubGenerator.visit_import_fromr(   c                 C  sX   |j D ]&\}}| j|| |d u r|dd }n|}| jd | | | qd S )Nr   r   rC  )idsr   r  r  rK  r   rq  )r   r   r  as_idtarget_namer   r   r   r    s   zStubGenerator.visit_importNr  Type | Noner   c                 C  s   || j d v r	dS | |s| |rdS | j d | |durJ| |}t|trI|jsI|jdkrI| j	j
dtv rI| |}|d| d7 }n| |}| j | d| dS )zReturn initializer for a variable.

        Return None if we've generated one already or if the variable is internal.
        rC  Nr
   r   r   rh  r  )rK  ra  rj  r   rv  r   rP   r   r   r   r  r  rU   rz  rJ  )r   r  r  r  r  	final_argr   r   r   ro    s$   



zStubGenerator.get_initstringc                 C  s   | j | dS )zAdd text to generated stub.N)rG  r   )r   r  r   r   r   r    s   zStubGenerator.addc                 C  s>   | j s| jttfvr| jd | j| j  d| d d S )Nr  @)rJ  rL  r   r   rH  r   r  r   r   r   r    s   zStubGenerator.add_decoratorc                 C  s   | j   d S r   )rH  clearr   r   r   r   rd    s   zStubGenerator.clear_decoratorsc                 C  s   || j v r	d| S |S )NrV  )rO  r  r   r   r   r    s   
zStubGenerator.typing_namec                 C     |  |}| j| dS )zAdd a name to be imported from typing, unless it's imported already.

        The import will be internal to the stub.
        Nr  r   r   r  r   r   r   r~       
zStubGenerator.add_typing_importc                 C  r  )zAdd a name to be imported from collections.abc, unless it's imported already.

        The import will be internal to the stub.
        Nr	  r  r   r   r   r|    r
  zStubGenerator.add_abc_importlinec                 C  s   || j vr| j | dS dS )zDAdd a line of text to the import section, unless it's already there.N)rI  r   )r   r  r   r   r   r    s   
zStubGenerator.add_import_linerb  r   c                 C  s    d|_ | | | j| d S )NT)rl  r  r   r   )r   rb  r   r   r   r   r   r    s   
z%StubGenerator.add_coroutine_decoratorc                 C  sP   d}| j r|d| j 7 }|d| j 7 }|r | jr |d7 }|d| j S )zReturn the text for the stub.r   r  )rI  r   r   r  rG  )r   r]  r   r   r   output  s   
zStubGenerator.outputc                 C  s*   |  |rdS | jr|  o|| jvS dS )NF)ra  rD  rm  r  r   r   r   rj    s
   
zStubGenerator.is_not_in_allc                 C  s4   | j rdS |tv rdS |do|d p|tv S )NFrV  __)rN  r`   ri  r  rp   )r   r   r<  r   r   r   ra    s
   zStubGenerator.is_private_namec                 C  s(   | d}|D ]
}| |r dS qdS )Nr   TF)r  ra  )r   r<  partspartr   r   r   r    s   

zStubGenerator.is_private_membercan_infer_optional
can_be_anyc                 C  s   t |trdS t |trdS t |trdS t |trdS t |tr)t |jtr)dS t |tr5|jdv r5dS |rNt |trN|jdkrN| 	d | 
d d	S |rZ| 	d | 
dS d
S )Nintr   bytesfloatr  r}   r   rQ  z | Noner   )r   r,   r3   r   r$   r6   r   r0   r   r~  r  )r   r  r  r  r   r   r   rz    s&   






z"StubGenerator.get_str_type_of_noder   rM   c                 C  s   t | }||S r   )r   r   )r   r   printerr   r   r   rv  '  s   
zStubGenerator.print_annotationc                 C  s
   | j dkS )z*Are we processing the top level of a file?r   )rJ  r   r   r   r   rm  +  s   
zStubGenerator.is_top_levelc                 C  s   |   r| j| dS dS )zbMark a name as defined.

        This only does anything if at the top level of a module.
        N)rm  rM  r   r  r   r   r   rq  /  s   zStubGenerator.record_namec                 C  s   |   o|| jv S )z'Has this name been recorded previously?)rm  rM  r  r   r   r   rk  7  r-  zStubGenerator.is_recorded_nameFFF)
rD  r   r   r}   rE  r}   r   r}   r   r   )r   r/   r   r   )r   r1   r   r   )FF)r   r&   r_  r}   r`  r}   r   r   )r   r#   r   r}   )r   r!   r   r   )r   r!   r   r  )r   r0   r  r!   r   r  )r   r   r<  r  r   r}   )r   r.   r  r!   r   r  r/  )r  r   r   r   )r   r   r   r   r   r   r   r   )r  r0   r  r   r   r   )T)r   r#   r  r}   r   r}   )r  r0   r  r#   r   r   )r   r'   r   r   )r   r)   r   r   )r   r*   r   r   )r   r(   r   r   r   )r  r   r  r#   r  r  r   r   )r  r   r   r   r  r  )r   r   r   r   )r  r   r   r   )rb  r&   r   r   r   r   r   r   r   )r   r   r   r}   )r   r   r<  r   r   r}   )r<  r   r   r}   )FT)r  r#   r  r}   r  r}   r   r   )r   rM   r   r   )r   r}   )-r   r   r   r   r   rZ  rf  r.  r}  r  rc  r  r  r  r,  r  r7  r  r  r  r  r  r  r  r  r  ro  r  r  rd  r  r~  r|  r  r  r  rj  ra  r  rz  rv  rm  rq  rk  r   r   r   r   r   r   6  s`    #

m



"
C
,

-

2


A














r   r  list[Statement]c                 C  sl   t  }| D ].}t|tr||j qt|tr ||jj qt|tr3|jD ]
}|	t
|g q(q|S r   )r  r   r&   r  r   r!   rb  r1   r   r  r  )r  r  defnr>  r   r   r   r  <  s   



r  c                   @  s    e Zd Zd
ddZdddZd	S )SelfTraverserr   r   c                 C  s
   g | _ d S r   )resultsr   r   r   r   r   K  r   zSelfTraverser.__init__r   r   c                 C  sP   |j d }t|tr"t|jtr$|jjdkr&| j|j|jf d S d S d S d S )Nr   r   )	r  r   r.   r   r0   r   r  r   r  )r   r   r  r   r   r   r  N  s   

z#SelfTraverser.visit_assignment_stmtNr  r  )r   r   r   r   r  r   r   r   r   r  J  s    
r  fdefr%   list[tuple[str, Expression]]c                 C  r!  )znFind attribute initializers in a method.

    Return a list of pairs (attribute name, r.h.s. expression).
    )r  r   r  )r  	traverserr   r   r   rn  X  s   
rn  r   r#   r   c                 C  s4   t | tr| jS t | trt| j d| j S tS )Nr   )r   r0   r   r.   r  r   r   )r   r   r   r   r  b  s
   

r  r   list[StubSource]c                 C  s   dd | D S )Nc                 S  s$   g | ]}|j d u st|j s|qS r   )r   is_blacklisted_pathr   r   r   r   r   rW  l  s    z.remove_blacklisted_modules.<locals>.<listcomp>r   )r   r   r   r   remove_blacklisted_modulesk  s   r"  r   r}   c                   s   t  fddtD S )Nc                 3  s     | ]}|t  d  v V  qdS )r  N)normalize_path_separators)r   substrr   r   r   r   r  s    z&is_blacklisted_path.<locals>.<genexpr>)rx  r\   r%  r   r%  r   r   q  s   r   c                 C  s   t jdkr| ddS | S )Nwin32\/)sysplatformr  r%  r   r   r   r#  u  s   
r#  options	mypy_optsMypyOptions)tuple[list[StubSource], list[StubSource]]c              
   C  s   | j s| jr%| jrt| j| j | j| j}g }n3t| j| j | j| j\}}n%zt	| j
|}W n ty@ } ztt||d}~ww dd |D }g }t|}||fS )ziCollect files for which we need to generate stubs.

    Return list of Python modules and C modules.
    Nc                 S     g | ]	}t |j|jqS r   r   r   r   r   r  r   r   r   rW    rX  z)collect_build_targets.<locals>.<listcomp>)rV   r   r|   find_module_paths_using_searchr   rz   find_module_paths_using_importsr   r   r   r   r   
SystemExitr   r"  )r+  r,  
py_modules	c_modulessource_listr9  r   r   r   collect_build_targets{  s&   
r8  r   rV   r   r   c                 C  s   t  o}g }g }tt|||}| | } dd | D } | D ]I}zt|||}	W n' tyN }
 zt }|r;tj	| |sDt
||
j| W Y d}
~
qd}
~
ww |	sY|t| q|	\}}|t||| q||fW  d   S 1 suw   Y  dS )zFind path and runtime value of __all__ (if possible) for modules and packages.

    This function uses runtime Python imports to get the information.
    c                 S  s   g | ]}t |s|qS r   )is_non_library_module)r   modr   r   r   rW    s
    z3find_module_paths_using_imports.<locals>.<listcomp>N)r   r  rC   r?   r<   	traceback
format_excr)  stdoutwriterB   messager   r   )r   rV   r   r   inspectr5  r6  r  r:  r  r9  tbr   r   r   r   r   r3    s4   $r3  r   c                 C  sN   |  drdS | dd drdS d| v s#d| v s#d| v s#d	| v r%dS d
S )z0Does module look like a test module or a script?)z.testsz.testz.testing_tests_test_suite	test_util
test_utils	test_basez	.__main__z	.conftestz.setupTr   rC  test_z.tests.z.test.z	.testing.z
.SelfTest.F)r  r  ri  )r   r   r   r   r9    s   r9  r  r  tuple[str, int]c                 C  s   t D ]@}dD ];}| d| }| d| s| |kr$|r$|df    S d| d | v rA|d | d| d d  df    S qq| |fS )N)z	six.movesr  r   r   r  )r[   r  	partition)r   r  r\  altr$  r   r   r   r    s   *r  r   rz   r{   c                 C  s   g }t tj |d}tdt| ddt|}t|ddd}| D ]}||}	t|	t	r5t
||	 d}
n|	}
|t||
 q!|D ]}||}|rQt
|t	j dd |D }|| qBdd |D }|S )a  Find sources for modules and packages requested.

    This function just looks for source files at the file system level.
    This is used if user passes --no-import, and will not find C modules.
    Exit if some of the modules or packages can't be found.
    N)r   r   )fscacher+  c                 S  r/  r   r0  r1  r   r   r   rW    rX  z2find_module_paths_using_search.<locals>.<listcomp>c                 S  s   g | ]	}t |js|qS r   )r9  r   r1  r   r   r   rW    rX  )r   r  r   default_data_dirr   r  r   find_moduler   r   r>   r   r   find_modules_recursive	NOT_FOUNDr  )r   rV   r   rz   r  typeshed_pathsearch_pathscacher   m_resultmodule_pathpackagep_resultsourcesr   r   r   r2    s&   	



r2  stubgen_optionsc                 C  s6   t  }d|_d|_d|_d|_| j|_d|_t|_	|S )z4Generate mypy options using the flag passed by user.skipFT)
r-  follow_importsincrementalr   semantic_analysis_onlyrz   python_versionshow_tracebackrA   transform_source)rX  r+  r   r   r   mypy_options  s   r`  r:  r   c                 C  s   | j dus	J dt| j d}| }W d   n1 sw   Y  tj|}t }tjj|| j | j||d| _	| j| j	_
| rZ| D ]}tj| d qGtd dS dS )zParse a source file.

    On success, store AST in the corresponding attribute of the stub source.
    If there are syntax errors, print them and exit.
    N Not found module was not skippedrb)fnamr   errorsr+  r  r  )r   openreadr  r  decode_python_encodingr   parser   r   	_fullnameis_blockersnew_messagesr)  stderrr>  exit)r:  r`  fdatar   rd  r  r   r   r   parse_source_file  s   

rp  r5  r   c              
   C  s   | sdS |rt dt|  d |r| D ]}t|| qdS ztdd | D |}W n ty> } ztd| |d}~ww | D ]}|j|j j|_	|j
du rY|jjj|j |_
qAdS )z8Use mypy to parse (and optionally analyze) source files.NzProcessing z	 files...c                 S  r  r   )r   r!  r   r   r   rW  7  r  z-generate_asts_for_modules.<locals>.<listcomp>z)Critical error during semantic analysis: )printr  rp  r   r   r4  graphr   treer   r   managersemantic_analyzer
export_map)r5  r   r`  r   r:  r   r9  r   r   r   generate_asts_for_modules)  s(   
rw  Ftargetr   r   c                 C  s   t | j|| |d}| jdusJ d| j| tj|}|r,tj|s,t| t	|d}|
d|  W d   dS 1 sGw   Y  dS )zUse analysed (or just parsed) AST to generate type stub for single file.

    If directory for target doesn't exist it will created. Existing stub
    will be overwritten.
    )r   rE  r   Nz5This function must be used only with analyzed moduleswr   )r   r   r   r   osr   dirnameisdirmakedirsre  r>  r   r  )r:  rx  r   r   r   gensubdirr  r   r   r   generate_stub_from_astB  s   
"r  r~   %tuple[dict[str, str], dict[str, str]]c           	   	   C  s   g }g }t  |  dD ]&}t|}t| \}}W d   n1 s%w   Y  ||7 }||7 }qtt|}tt|}||fS )zGather all function and class signatures in the docs.

    Return a tuple (function signatures, class signatures).
    Currently only used for C modules.
    z/*.rstN)globre  r:   	readlinesdictr9   )	r~   all_sigsall_class_sigsr   rn  loc_sigsloc_class_sigssigs
class_sigsr   r   r   collect_docs_signatures_  s   

r  c           	   	     s  t | }t| |\}}d }}| jrt| j\}}t|| j|| j g }|D ]V  jdus1J d j	dd}t
j jdkrF|d7 }n|d7 }t
j| j|}|| t j|| j| j t || j| j| j W d   n1 sww   Y  q&|D ]R t fdd	|| D r j	ddd }n	 j	ddd }t
j| j|}|| t j|| j| j t j|||d
 W d   n1 sw   Y  qt|t| }| js|dkr
td|  t|dkrtd|d   dS tdt| t
j  dS dS dS )z!Main entry point for the program.Nra  r   r(  z__init__.pyz/__init__.pyiz.pyic                 3  s"    | ]}|j  j d  V  qdS )r   N)r   ri  )r   py_modr:  r   r   r     s     z!generate_stubs.<locals>.<genexpr>)r  r  r   zProcessed %d modulesr  z
Generated zGenerated files under )r`  r8  r~   r  rw  r   r   r   r   r  rz  basenamer   r   r   r@   r   r  r   r   rx  r;   r  r   rq  r=   r  )	r+  r,  r5  r6  r  r  r   rx  num_modulesr   r  r   generate_stubsq  sL   


r  z^%(prog)s [-h] [more options, see -h]
                     [-m MODULE] [-p PACKAGE] [files ...]z
Generate draft stubs for modules.

Stubs are generated in directory ./out, to avoid overriding files with
manual changes.  This directory is assumed to exist.
r   c                 C  s  t jdttd}|jdddd |jdddd |jd	dd
d |jdddd |jdddd |jddddd |jddddd |jddddd |jddddd |jdddddd d! |jd"d#d$d%d&g d'd( |jd)d*d$d+d,g d-d( |jd.d/d.d0d1 || }tjd d2 }tj|_	|j
|j r|jr|d3 |jr|jr|d4 tj|jst|j t||j|j|jd5|j	|j|j|j|j|j
|j|j|j|j|jd6S )7Nr   )progusagedescriptionz--ignore-errors
store_truez7ignore errors when trying to generate stubs for modules)actionhelpz--no-importz{don't import the modules, just parse and analyze them (doesn't work with C extension modules and might not respect __all__)z--parse-onlyz{don't perform semantic analysis of sources, just parse them (only applies to Python modules, might affect quality of stubs)z--include-privatezqgenerate stubs for objects and members considered private (single leading underscore and no trailing underscores)z--export-lesszQdon't implicitly export all names imported from other modules in the same packagez-vz	--verbosezshow more verbose messagesz-qz--quietzshow fewer messagesz	--doc-dirPATHr   zuse .rst documentation in PATH (this may result in better stubs in some cases; consider setting this to DIR/Python-X.Y.Z/Doc/library))metavardefaultr  z--search-pathzaspecify module search directories, separated by ':' (currently only used if --no-import is given)z-oz--outputr   outz2change the output directory [default: %(default)s])r  destr  r  z-mz--moduler   MODULEr   z5generate stub for module; can repeat for more modules)r  r  r  r  r  z-pz	--packagePACKAGErV   z7generate stubs for package recursively; can be repeatedr   r   z-generate stubs for given files or directories)r  nargsr  r  r  z3May only specify one of: modules/packages or files.z.Cannot specify both quiet and verbose messages:)rz   r|   r~   r   r   r   r   r   r   r   rV   r   r   r   r   )argparseArgumentParserHEADERDESCRIPTIONadd_argument
parse_argsr)  version_info
executabler   r   rV   r   errorr   r   rz  r   existsr   r}  r7   r|   r~   r   r  r   r   r   r   )r   parsernsrz   r   r   r   parse_options  s   		



r  r   c                 C  sX   t jd dtjv sdtjv stjdd t| d u r#tjdd  n| }t| d S )Nr   r   r   r   r  )	r  r  check_python_versionr)  r   insertr  argvr  )r   r+  r   r   r   main  s
   r  r  )r  r/   r   r   )r  r  r   r   )r  r%   r   r  )r   r#   r   r   )r   r  r   r  )r   r   r   r}   )r   r   r   r   )r+  r7   r,  r-  r   r.  )
r   r   rV   r   r   r}   r   r}   r   r.  )r   r   r   r}   )r   r   r  r  r   rH  )
r   r   rV   r   r   r   rz   r{   r   r  )rX  r7   r   r-  )r:  r   r`  r-  r   r   )
r5  r  r   r}   r`  r-  r   r}   r   r   r  )r:  r   rx  r   r   r}   r   r}   r   r}   r   r   )r~   r   r   r  )r+  r7   r   r   )r   r   r   r7   r   )r   r   r   r   )r   r  r   r  r  rz  os.pathr)  r;  collectionsr   rS   r   r   r   r   r   r	   rT   r
   
mypy.buildr  mypy.mixedtraverser
mypy.parsemypy.traverser	mypy.utilr   mypy.errorsr   r   mypy.find_sourcesr   r   mypy.modulefinderr   r   r   r   r   mypy.moduleinspectr   
mypy.nodesr   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   mypy.optionsr7   r-  mypy.stubdocr8   r9   r:   mypy.stubgencr;   mypy.stubutilr<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   
mypy.typesrG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   mypy.visitorrR   rU   __annotations__r[   r\   r`   rp   ry   r   r   r   r   r   r   r   r   r   r   r   r  r%  r  TraverserVisitorr"  r2  mixedtraverserMixedTraverserVisitorr0  r   r  r  rn  r  r"  r   r#  r8  r3  r9  r  r2  r`  rp  rw  r  r  r  r  r  r  r  r   r   r   r   r   <module>   s   ( #(
4	+7=
q
'      




	



 
!


!



.
u

