A cache for loaded PyTD files. Typically, you'll have one instance of this class, per module. Attributes: options: A config.Options object. builtins: The builtins ast. typing: The typing ast.
Method | __init__ |
Undocumented |
Method | add |
Undocumented |
Method | concat |
Undocumented |
Method | finish |
Verify the ast, doing external type resolution first if necessary. |
Method | get |
Undocumented |
Method | get |
Gets a name -> ResolvedModule map of the loader's resolved modules. |
Method | has |
Undocumented |
Method | import |
Undocumented |
Method | import |
Import a module relative to our base module. |
Method | import |
IMPORT_NAME with level=-1. A name relative to the current directory. |
Method | load |
Load a module from a filename. |
Method | load |
Load (or retrieve from cache) a module and resolve its dependencies. |
Method | lookup |
Undocumented |
Method | resolve |
Resolve the dependencies of an AST, without adding it to our modules. |
Method | resolve |
Resolve and verify pytd value, using the given ast for local lookup. |
Method | save |
Save to a pickle. See PickledPyiLoader.load_from_pickle for reverse. |
Instance Variable | builtins |
Undocumented |
Instance Variable | options |
Undocumented |
Instance Variable | typing |
Undocumented |
Method | _create |
Undocumented |
Method | _import |
Load a name like 'sys' or 'foo.bar.baz'. |
Method | _load |
Fill in all ClassType.cls pointers and load reexported modules. |
Method | _load |
Load a pytd/pyi that ships with pytype or typeshed. |
Method | _process |
Create a module from a loaded ast and save it to the loader cache. |
Method | _resolve |
Undocumented |
Method | _resolve |
Undocumented |
Method | _resolve |
Undocumented |
Method | _resolve |
Undocumented |
Method | _try |
Try importing all prefixes of name, returning the first valid module. |
Instance Variable | _aliases |
Undocumented |
Instance Variable | _builtin |
Undocumented |
Instance Variable | _import |
Undocumented |
Instance Variable | _module |
Undocumented |
Instance Variable | _modules |
Undocumented |
Instance Variable | _prefixes |
Undocumented |
Instance Variable | _resolver |
Undocumented |
Instance Variable | _typeshed |
Undocumented |
Import a module relative to our base module. Args: level: Relative level: https://docs.python.org/2/library/functions.html#__import__ E.g. 1: "from . import abc" 2: "from .. import abc" etc. Since you'll use import_name() for -1 and 0, this function expects the level to be >= 1. Returns: The parsed pytd. Instance of pytd.TypeDeclUnit. None if we can't find the module. Raises: ValueError: If we don't know the name of the base module.
pytype.load_pytd.PickledPyiLoader
Load (or retrieve from cache) a module and resolve its dependencies.
Load a name like 'sys' or 'foo.bar.baz'. Args: module_name: The name of the module. May contain dots. Returns: The parsed file, instance of pytd.TypeDeclUnit, or None if we the module wasn't found.
Create a module from a loaded ast and save it to the loader cache. Args: mod_info: The metadata of the module being imported. mod_ast: The pytd.TypeDeclUnit representing the module. Returns: The ast (pytd.TypeDeclUnit) as represented in this loader.