class ImportsMapBuilder: (source)
Build an imports map from (short_path, path) pairs.
Method | __init__ |
Undocumented |
Method | build |
Create an ImportsMap from a .imports_info file. |
Method | build |
Create a file mapping from a list of (short path, path) tuples. |
Instance Variable | options |
Undocumented |
Method | _build |
Build a multimap from a list of (short_path, path) pairs. |
Method | _finalize |
Generate the final imports map. |
Method | _read |
Read the imports_map file. |
Method | _validate |
Validate the imports map against the command line arguments. |
Create an ImportsMap from a .imports_info file. Builds a dict of short_path to full name (e.g. "path/to/file.py" => "$GENDIR/rulename~~pytype-gen/path_to_file.py~~pytype" Args: path: The file with the info (may be None, for do-nothing) Returns: Dict of .py short_path to list of .pytd path or None if no path Raises: ValueError if the imports map is invalid
Optional[ List[ ItemType]]
, path=None) -> Optional[ ImportsMapType]
:
(source)
¶
Create a file mapping from a list of (short path, path) tuples. Builds a dict of short_path to full name (e.g. "path/to/file.py" => "$GENDIR/rulename~~pytype-gen/path_to_file.py~~pytype" Args: items: A list of (short_path, full_path) tuples. path: The file from which the items were read (for error messages) Returns: Dict of .py short_path to list of .pytd path or None if no items Raises: ValueError if the imports map is invalid