def test_get_full_path(self): self.assertEqual( os.path.join(self.root, "foo/bar"), pytype_source_utils.get_full_path("foo/bar")) self.assertEqual( "/foo/bar", pytype_source_utils.get_full_path("/foo/bar"))
def get_pytd_paths(self, python_version): """Gets the paths to pytype's version-specific pytd files.""" # TODO(mdemello): Should we add 2and3 here too and stop symlinking? return [ pytype_source_utils.get_full_path(d) for d in [ "stubs/builtins/%d" % python_version[0], "stubs/stdlib/%d" % python_version[0] ] ]
def __init__(self): self._env_home = home = os.getenv("TYPESHED_HOME") if home: if not os.path.isdir(home): raise IOError("Could not find a typeshed installation in " "$TYPESHED_HOME directory %s" % home) self._root = home else: self._root = pytype_source_utils.get_full_path("typeshed") self._missing = frozenset(self._load_missing())
def __init__(self): self._env_home = home = os.getenv("TYPESHED_HOME") if home: if not os.path.isdir(home): raise IOError("Could not find a typeshed installation in " "$TYPESHED_HOME directory %s" % home) self._root = home else: self._root = pytype_source_utils.get_full_path("typeshed") self._missing = frozenset(self._load_missing()) # See https://github.com/google/pytype/issues/820. typeshed's directory # structure significantly changed in January 2021. We need to support both # the old and the new structures until our bundled typeshed is updated past # the restructuring commit. self._use_new_structure = os.path.exists( os.path.join(self._root, "stdlib", "VERSIONS")) if self._use_new_structure: self._stdlib_versions = self._load_stdlib_versions() self._third_party_packages = self._load_third_party_packages()
def get_pytd_paths(self): """Gets the paths to pytype's version-specific pytd files.""" return [ pytype_source_utils.get_full_path(d) for d in ("stubs/builtins", "stubs/stdlib") ]