class Converter(utils.ContextWeakrefMixin): (source)
Functions for converting abstract classes into PyTD.
Class |
|
Controls the level of detail in pytd types. See set_output_mode. |
Method | __init__ |
Undocumented |
Method | annotations |
Get instance types for annotations not present in the members map. |
Method | optimize |
Optimize output of literal data structures in pyi files. |
Method | set |
Change the level of detail in pytd types. |
Method | signature |
Converts a function.Signature object into a callable object. |
Method | value |
Get the PyTD type an instance of this object would have. |
Method | value |
Get a PyTD definition for this object. |
Method | value |
Get a PyTD type representing this object, as seen at a node. |
Method | _class |
Convert an InterpreterClass to a PyTD definition. |
Method | _function |
Undocumented |
Method | _function |
Get a function call's pytd return type. |
Method | _function |
Convert an InterpreterFunction to a PyTD definition. |
Method | _function |
Convert a function variable to a list of PyTD return types. |
Method | _get |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _ordered |
Get instance types for ordered attrs in the metadata. |
Method | _simple |
Convert a SimpleFunction to a PyTD definition. |
Method | _type |
Undocumented |
Method | _type |
Undocumented |
Method | _typed |
Undocumented |
Method | _value |
Get PyTD types for the parameters of an instance of an abstract value. |
Instance Variable | _optimize |
Undocumented |
Instance Variable | _output |
Undocumented |
Instance Variable | _scopes |
Undocumented |
Property | _detailed |
Undocumented |
Inherited from ContextWeakrefMixin
:
Class Variable | __slots__ |
Undocumented |
Instance Variable | ctx |
Undocumented |
Property | ctx |
Undocumented |
Change the level of detail in pytd types. Args: mode: Converter.OutputMode option controlling the level of detail to use. NORMAL - the default, safe for pyi files. DETAILED - more detail, unsafe for pyi files. The converter will do things like using the names of inner classes rather than Any and including the known argument types for a callable even if the argument count is unknown. Useful for error messages. LITERAL - like DETAILED, but bool, int, str, and bytes constants will be emitted as Literal[<constant>] rather than their type. Yields: None.
Converts a function.Signature object into a callable object. Args: sig: The signature to convert. Returns: An abstract.CallableClass representing the signature, or an abstract.ParameterizedClass if the signature has a variable number of arguments.
Get the PyTD type an instance of this object would have. Args: node: The node. v: The object. instance: The instance. seen: Already seen instances. view: A Variable -> binding map. Returns: A PyTD type.
Get a PyTD definition for this object. Args: node: The node. v: The object. name: The object name. Returns: A PyTD definition.
Get a PyTD type representing this object, as seen at a node. Args: node: The node from which we want to observe this object. v: The object. seen: The set of values seen before while computing the type. view: A Variable -> binding map. Returns: A PyTD type.
Undocumented