class Typeshed: (source)
A typeshed installation. The location is either retrieved from the environment variable "TYPESHED_HOME" (if set) or otherwise assumed to be directly under pytype (i.e., /{some_path}/pytype/typeshed).
Method | __init__ |
Initializer. |
Method | blacklisted |
Return the blacklist, as a list of module names. E.g. ["x", "y.z"]. |
Method | get |
Get the names of all modules in typeshed or bundled with pytype. |
Method | get |
Get the contents of a typeshed .pyi file. |
Method | get |
Gets the paths to pytype's version-specific pytd files. |
Method | get |
Gets the paths to typeshed's version-specific pyi files. |
Method | read |
Read the typeshed blacklist. |
Constant | MISSING |
Undocumented |
Property | missing |
Set of known-missing typeshed modules, as strings of paths. |
Method | _get |
Gets module names from the `missing` list. |
Method | _is |
Undocumented |
Method | _list |
Lists modules for _get_module_names_in_path. |
Method | _load |
Undocumented |
Method | _load |
Loads the contents of typeshed/stdlib/VERSIONS. |
Method | _load |
Loads package and Python version information for typeshed/stubs/. |
Method | _lookup |
Looks up the prefix chain until we find the module in stdlib/VERSIONS. |
Instance Variable | _missing |
Undocumented |
Instance Variable | _stdlib |
Undocumented |
Instance Variable | _store |
Undocumented |
Instance Variable | _third |
Undocumented |
Initializer. Args: missing_modules: A collection of modules in the format 'stdlib/module_name', which will be combined with the contents of MISSING_FILE to form a set of missing modules for which pytype will not report errors.
Get the contents of a typeshed .pyi file. Arguments: namespace: selects a top-level directory within typeshed/ Allowed values are "stdlib" and "third_party". "third_party" corresponds to the the typeshed/stubs/ directory. module: module name (e.g., "sys" or "__builtins__"). Can contain dots, if it's a submodule. Package names should omit the "__init__" suffix (e.g., pass in "os", not "os.__init__"). version: The Python version. (major, minor) Returns: A tuple with the filename and contents of the file Raises: IOError: if file not found
Loads the contents of typeshed/stdlib/VERSIONS. VERSIONS lists the stdlib modules with the Python version in which they were first added, in the format `{module}: {min_major}.{min_minor}-` or `{module}: {min_major}.{min_minor}-{max_major}.{max_minor}`. Returns: A mapping from module name to version range in the format {name: ((min_major, min_minor), (max_major, max_minor))} The max tuple can be `None`.
Loads package and Python version information for typeshed/stubs/. stubs/ contains type information for third-party packages. Each top-level directory corresponds to one PyPI package and contains one or more modules, plus a metadata file (METADATA.toml). The top-level directory may contain a @tests subdirectory for typeshed testing. Returns: A mapping from module name to a set of package names.