class documentation

Look up NamedType pointers using a symbol table.

Method __init__ Create this visitor.
Method EnterAlias Undocumented
Method EnterGenericType Undocumented
Method EnterTypeDeclUnit Undocumented
Method LeaveAlias Undocumented
Method LeaveGenericType Undocumented
Method VisitClassType Undocumented
Method VisitGenericType Undocumented
Method VisitNamedType Try to look up a NamedType.
Method VisitTypeDeclUnit Add star imports to the ast.
Instance Variable name Undocumented
Method _DiscardExistingNames Undocumented
Method _EquivalentAliases Undocumented
Method _HandleDuplicates Handle duplicate module-level aliases.
Method _ImportAll Get the new members that would result from a star import of the module.
Method _LookupModuleRecursive Undocumented
Method _ModulePrefix Undocumented
Method _ResolveAlias Undocumented
Method _ResolveUsingGetattr Try to resolve an identifier using the top level __getattr__ function.
Method _ResolveUsingStarImport Try to use any star imports in 'module' to resolve 'name'.
Instance Variable _alias_name Undocumented
Instance Variable _in_generic_type Undocumented
Instance Variable _module_alias_map Undocumented
Instance Variable _module_map Undocumented
Instance Variable _star_imports Undocumented
Instance Variable _unit Undocumented

Inherited from _RemoveTypeParametersFromGenericAny:

Class Variable unchecked_node_names Undocumented

Inherited from _ToTypeVisitor (via _RemoveTypeParametersFromGenericAny):

Method EnterLiteral Undocumented
Method LeaveLiteral Undocumented
Method to_type Undocumented
Instance Variable allow_functions Undocumented
Instance Variable allow_singletons Undocumented
Instance Variable _in_alias Undocumented
Instance Variable _in_literal Undocumented

Inherited from Visitor (via _RemoveTypeParametersFromGenericAny, _ToTypeVisitor):

Method Enter Undocumented
Method Leave Undocumented
Method Visit Undocumented
Class Variable old_node Undocumented
Class Variable visits_all_node_types Undocumented
Instance Variable enter_functions Undocumented
Instance Variable leave_functions Undocumented
Instance Variable visit_class_names Undocumented
Instance Variable visit_functions Undocumented
Class Variable _visitor_functions_cache Undocumented
def __init__(self, module_map, self_name=None, module_alias_map=None): (source)

Create this visitor. Args: module_map: A dictionary mapping module names to symbol tables. self_name: The name of the current module. If provided, then the visitor will ignore nodes with this module name. module_alias_map: A dictionary mapping module aliases to real module names. If the source contains "import X as Y", module_alias_map should contain an entry mapping "Y": "X".

def EnterAlias(self, t): (source)
def EnterGenericType(self, _): (source)

Undocumented

def EnterTypeDeclUnit(self, node): (source)

Undocumented

def LeaveAlias(self, t): (source)
def LeaveGenericType(self, _): (source)

Undocumented

def VisitClassType(self, t): (source)

Undocumented

def VisitNamedType(self, t): (source)

Try to look up a NamedType. Args: t: An instance of pytd.NamedType Returns: The same node t. Raises: KeyError: If we can't find a module, or an identifier in a module, or if an identifier in a module isn't a class.

def VisitTypeDeclUnit(self, node): (source)

Add star imports to the ast. Args: node: A pytd.TypeDeclUnit instance. Returns: The pytd.TypeDeclUnit instance, with star imports added. Raises: KeyError: If a duplicate member is found during import.

Undocumented

def _DiscardExistingNames(self, node, potential_members): (source)

Undocumented

def _EquivalentAliases(self, alias1, alias2) -> bool: (source)

Undocumented

def _HandleDuplicates(self, new_aliases): (source)

Handle duplicate module-level aliases. Aliases pointing to qualified names could be the result of importing the same entity through multiple import paths, which should not count as an error; instead we just deduplicate them. Args: new_aliases: The list of new aliases to deduplicate Returns: A deduplicated list of aliases. Raises: KeyError: If there is a name clash.

def _ImportAll(self, module): (source)

Get the new members that would result from a star import of the module. Args: module: The module name. Returns: A tuple of: - a list of new aliases, - a set of new __getattr__ functions.

def _LookupModuleRecursive(self, name): (source)

Undocumented

def _ModulePrefix(self): (source)

Undocumented

def _ResolveAlias(self, alias): (source)

Undocumented

def _ResolveUsingGetattr(self, module_name, module): (source)

Try to resolve an identifier using the top level __getattr__ function.

def _ResolveUsingStarImport(self, module, name): (source)

Try to use any star imports in 'module' to resolve 'name'.

_alias_name = (source)

Undocumented

_in_generic_type: int = (source)

Undocumented

_module_alias_map = (source)

Undocumented

_module_map = (source)

Undocumented

_star_imports = (source)

Undocumented

Undocumented