Stub generator for C modules. The public interface is via the mypy.stubgen module.
Class |
|
Undocumented |
Class |
|
No class docstring; 0/2 instance variable, 1/3 method documented |
Class |
|
Undocumented |
Class |
|
Abstract base class for extracting a list of FunctionSigs for each function. |
Function | add |
Add typing imports for collections/types that occur in the generated stub. |
Function | generate |
Generate stub for a single function or method. |
Function | generate |
Generate property stub using introspection of 'obj'. |
Function | generate |
Generate stub for a single class using runtime introspection. |
Function | generate |
Generate stub for C module. |
Function | get |
Undocumented |
Function | infer |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | is |
Undocumented |
Function | method |
Sort methods in classes in a typical order. |
Function | strip |
Strips unnecessary module names from typ. |
Constant | _DEFAULT |
Undocumented |
ModuleType
, name: str
, obj: object
, output: list[ str]
, imports: list[ str]
, sig_generators: Iterable[ SignatureGenerator]
, self_var: str|None
= None, class_name: str|None
= None):
(source)
¶
Generate stub for a single function or method. The result (always a single line) will be appended to 'output'. If necessary, any required names will be added to 'imports'. The 'class_name' is used to find signature of __init__ or __new__ in 'class_sigs'.
str
, obj: object
, static_properties: list[ str]
, rw_properties: list[ str]
, ro_properties: list[ str]
, readonly: bool
, module: ModuleType|None
= None, imports: list[ str]|None
= None):
(source)
¶
Generate property stub using introspection of 'obj'. Try to infer type from docstring, append resulting lines to 'output'.
ModuleType
, class_name: str
, obj: type
, output: list[ str]
, imports: list[ str]
, sig_generators: Iterable[ SignatureGenerator]
):
(source)
¶
Generate stub for a single class using runtime introspection. The result lines will be appended to 'output'. If necessary, any required names will be added to 'imports'.
str
, target: str
, sig_generators: Iterable[ SignatureGenerator]
):
(source)
¶
Generate stub for C module. Signature generators are called in order until a list of signatures is returned. The order is: - signatures inferred from .rst documentation (if given) - simple runtime introspection (looking for docstrings and attributes with simple builtin types) - fallback based special method names or "(*args, **kwargs)" If directory for target doesn't exist it will be created. Existing stub will be overwritten.
Strips unnecessary module names from typ. If typ represents a type that is inside module or is a type coming from builtins, remove module declaration from it. Return stripped name of the type. Arguments: typ: name of the type module: in which this type is used imports: list of import statements (may be modified during the call)