Home
last modified time | relevance | path

Searched +full:module +full:- +full:importer (Results 1 – 25 of 357) sorted by relevance

12345678910>>...15

/aosp_15_r20/external/pytorch/torch/package/
H A Dimporter.py1 # mypy: allow-untyped-defs
4 from pickle import ( # type: ignore[attr-defined]
15 __all__ = ["ObjNotFoundError", "ObjMismatchError", "Importer", "OrderedImporter"]
19 """Raised when an importer cannot find an object by searching for its name."""
23 …"""Raised when an importer found a different object with the same name as the user-provided one."""
26 class Importer(ABC): class
29 By default, you can figure out what module an object belongs by checking
32 torch.package introduces module importers other than the default one.
37 import_module: module_name -> module object
38 get_name: object -> (parent module name, name of obj within module)
[all …]
H A Dpackage_exporter.py1 # mypy: allow-untyped-defs
40 from .importer import Importer, OrderedImporter, sys_importer
56 """Represents one of the actions that :class:`PackageExporter` can take on a module.
65 # Special case: when a module is mocked, PackageExporter writes out a
66 # `_mock` module that implements our mocking stubs. If we re-package code,
67 # we may encounter a `_mock` module from the original package. If we do,
68 # just ignore it and write a `_mock` module once.
70 # Special case: PackageImporter adds a fake module
72 # re-export this.
87 "Module is a C extension module. torch.package supports Python modules only."
[all …]
H A Dpackage_importer.py1 # mypy: allow-untyped-defs
39 from .importer import Importer
56 # FX GraphModule might depend on builtins module and users usually
74 class PackageImporter(Importer):
81 The importer for packages ensures that code in the module can only be loaded from
85 a locally-installed package, but then fails when the package is copied to another machine.
89 local to this importer.
103 …file_or_buffer: a file-like object (has to implement :meth:`read`, :meth:`readline`, :meth:`tell`,…
105 …le_allowed (Callable[[str], bool], optional): A method to determine if a externally provided module
110 ImportError: If the package will use a disallowed module.
[all …]
H A D_package_pickler.py1 # mypy: allow-untyped-defs
2 from pickle import ( # type: ignore[attr-defined]
18 from .importer import Importer, ObjMismatchError, ObjNotFoundError, sys_importer
22 """Package-aware pickler.
24 This behaves the same as a normal pickler, except it uses an `Importer`
28 def __init__(self, importer: Importer, *args, **kwargs): argument
29 self.importer = importer
32 # Make sure the dispatch table copied from _Pickler is up-to-date.
45 write = self.write # type: ignore[attr-defined]
46 memo = self.memo # type: ignore[attr-defined]
[all …]
/aosp_15_r20/external/python/cpython2/Lib/
Dimputil.py7 Importer Base class for replacing standard import functions
13 warnpy3k("the imputil module has been removed in Python 3.0", stacklevel=2)
16 # note: avoid importing non-builtin modules
25 __all__ = ["ImportManager","Importer","BuiltinImporter"]
66 # so let's just load the OS-related facilities.
70 # This is the Importer that we use for grabbing stuff from the
78 # The default will import dynamic-load modules first, followed by
87 """Python calls this hook to locate and import a module."""
94 # if there is a parent, then its importer should manage this import
96 module = parent.__importer__._do_import(parent, parts, fromlist)
[all …]
Dpkgutil.py29 """Make a trivial single-dispatch generic function"""
75 'prefix' is a string to output on the front of every module name
102 for importer, name, ispkg in iter_modules(path, prefix):
103 yield importer, name, ispkg
128 or, if path is None, all top-level modules on sys.path.
133 'prefix' is a string to output on the front of every module name
151 def iter_importer_modules(importer, prefix=''): argument
152 if not hasattr(importer, 'iter_modules'):
154 return importer.iter_modules(prefix)
160 """PEP 302 Importer that wraps Python's "classic" import algorithm
[all …]
Drunpy.py1 """runpy.py - locating and running Python code using the module namespace
4 module namespace instead of the native filesystem.
6 This allows Python code to play nicely with non-filesystem based PEP 302
25 """Temporarily replace a module in sys.modules with an empty namespace"""
28 self.module = imp.new_module(mod_name)
37 sys.modules[mod_name] = self.module
80 mod_globals = temp_module.module.__dict__
83 # Copy the globals of the temporary module, as they
84 # may be cleared when the temporary module goes away
89 # loader protocol (specifically, "get_filename" is non-standard)
[all …]
/aosp_15_r20/external/python/apitools/apitools/base/protorpclite/
Dmessages_test.py9 # http://www.apache.org/licenses/LICENSE-2.0
34 # pylint:disable=function-redefined
35 # pylint:disable=global-variable-not-assigned
36 # pylint:disable=global-variable-undefined
37 # pylint:disable=redefined-outer-name
38 # pylint:disable=undefined-variable
39 # pylint:disable=unused-variable
40 # pylint:disable=too-many-lines
51 MODULE = messages variable in ModuleInterfaceTest
74 global Color # pylint:disable=global-variable-not-assigned
[all …]
/aosp_15_r20/external/pytorch/docs/source/
H A Dpackage.rst2 .. py:module:: torch.package.analyze
13 This document contains tutorials, how-to guides, explanations, and an API reference that
19 This module depends on the ``pickle`` module which is not secure. Only unpackage data you trust.
24 …iew the `documentation <https://docs.python.org/3/library/pickle.html>`_ for the ``pickle`` module.
32 ---------
36 `on Colab <https://colab.research.google.com/drive/1lFZkLyViGfXxB-m3jqlyTQuYToo3XLo->`_.
41 -----------
71 * The Python ``zipfile`` module provides a standard way to read and write ZIP archive contents.
101 use the glob-style ``include`` and ``exclude`` filtering arguments.
109 importer = PackageImporter('my_package.pt')
[all …]
/aosp_15_r20/external/pytorch/test/package/
H A Dtest_package_script.py75 class ModuleInterface(torch.nn.Module):
76 def one(self, inp1: Tensor) -> Tensor:
79 class ImplementsInterface(torch.nn.Module):
80 def one(self, inp1: Tensor) -> Tensor:
83 class UsesInterface(torch.nn.Module):
86 def __init__(self) -> None:
90 def forward(self, input: Tensor) -> Tensor:
135 importer = PackageImporter(buffer)
136 obj_loaded = importer.load_pickle("obj", "obj.pkl")
189 importer = PackageImporter(buffer)
[all …]
H A Dtest_importer.py7 Importer,
24 """Tests for Importer and derived classes."""
39 importer = sys_importer
41 module_name, type_name = importer.get_name(type_)
43 module = importer.import_module(module_name)
44 self.assertIs(getattr(module, type_name), type_)
55 importer = PackageImporter(buffer)
57 # Construct an importer-only environment.
58 ordered_importer = OrderedImporter(importer)
60 # The module returned by this environment should be the same one that's
[all …]
/aosp_15_r20/external/python/cpython3/Lib/test/test_importlib/import_/
Dtest_path.py24 module = '<test module>'
26 self.assertIsNone(self.find(module))
31 module = '<test module>'
33 importer = util.mock_spec(module)
34 with util.import_state(path_importer_cache={path: importer},
36 found = self.find(module)
37 self.check_found(found, importer)
42 module = '<test module>'
44 importer = util.mock_spec(module)
45 with util.import_state(path_importer_cache={path: importer}):
[all …]
/aosp_15_r20/external/python/cpython3/Lib/test/test_importlib/
Dtest_lazy.py17 def exec_module(self, module): argument
27 lazy_loader = factory('module name', 'module path', kw='kw')
29 self.assertEqual(('module name', 'module path'), loader.args)
50 def exec_module(self, module): argument
51 exec(self.source_code, module.__dict__)
52 self.loaded = module
68 module = spec.loader.create_module(spec)
69 if module is None:
70 module = types.ModuleType(TestingImporter.module_name)
71 module.__spec__ = spec
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r530567/python3/lib/python3.11/
Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r522817/python3/lib/python3.11/
Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/prebuilts/build-tools/common/py3-stdlib/
H A Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r536225/python3/lib/python3.11/
Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/external/python/cpython3/Lib/
Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r530567b/python3/lib/python3.11/
Dpkgutil.py23 ModuleInfo.__doc__ = 'A namedtuple with minimal info about a module.'
27 """Return the finder-specific module spec."""
60 'prefix' is a string to output on the front of every module name
112 or, if path is None, all top-level modules on sys.path.
117 'prefix' is a string to output on the front of every module name
137 def iter_importer_modules(importer, prefix=''): argument
138 if not hasattr(importer, 'iter_modules'):
140 return importer.iter_modules(prefix)
144 def _iter_file_finder_modules(importer, prefix=''): argument
145 if importer.path is None or not os.path.isdir(importer.path):
[all …]
/aosp_15_r20/external/pytorch/torch/fx/
H A Dgraph_module.py1 # mypy: allow-untyped-defs
16 from torch.nn.modules.module import _addindent
17 from torch.package import Importer, PackageExporter, PackageImporter, sys_importer
32 # the linecache module to recover it.
45 src (str): The module source to cache
46 globals (dict): The module globals
70 def get_source(self, module_name) -> Optional[str]:
97 ) -> Callable:
106 def _format_import_statement(name: str, obj: Any, importer: Importer) -> str: argument
111 module_name, attr_name = importer.get_name(obj)
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r530567b/python3/lib/python3.11/site-packages/pip/_vendor/pkg_resources/
D__init__.py3 --------------------
16 This module is deprecated. Users are directed to
124 _PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
197 plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
299 An already-installed version conflicts with the requested version.
320 If required_by is non-empty, return a version of self that is a
382 DEVELOP_DIST = -1
388 `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
389 and `provider_factory` is a function that, passed a *module* object,
390 returns an ``IResourceProvider`` for that module.
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r536225/python3/lib/python3.11/site-packages/pip/_vendor/pkg_resources/
D__init__.py3 --------------------
16 This module is deprecated. Users are directed to
124 _PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
197 plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
299 An already-installed version conflicts with the requested version.
320 If required_by is non-empty, return a version of self that is a
382 DEVELOP_DIST = -1
388 `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
389 and `provider_factory` is a function that, passed a *module* object,
390 returns an ``IResourceProvider`` for that module.
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r522817/python3/lib/python3.11/site-packages/pip/_vendor/pkg_resources/
D__init__.py3 --------------------
16 This module is deprecated. Users are directed to
124 _PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
197 plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
299 An already-installed version conflicts with the requested version.
320 If required_by is non-empty, return a version of self that is a
382 DEVELOP_DIST = -1
388 `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
389 and `provider_factory` is a function that, passed a *module* object,
390 returns an ``IResourceProvider`` for that module.
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r530567/python3/lib/python3.11/site-packages/pip/_vendor/pkg_resources/
D__init__.py3 --------------------
16 This module is deprecated. Users are directed to
124 _PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
197 plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
299 An already-installed version conflicts with the requested version.
320 If required_by is non-empty, return a version of self that is a
382 DEVELOP_DIST = -1
388 `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
389 and `provider_factory` is a function that, passed a *module* object,
390 returns an ``IResourceProvider`` for that module.
[all …]
/aosp_15_r20/prebuilts/clang/host/linux-x86/clang-r530567/python3/lib/python3.11/site-packages/pkg_resources/
D__init__.py3 --------------------
191 plat = 'macosx-%s-%s' % ('.'.join(_macos_vers()[:2]), m.group(3))
257 An already-installed version conflicts with the requested version.
278 If required_by is non-empty, return a version of self that is a
338 DEVELOP_DIST = -1
344 `loader_type` is the type or class of a PEP 302 ``module.__loader__``,
345 and `provider_factory` is a function that, passed a *module* object,
346 returns an ``IResourceProvider`` for that module.
352 """Return an IResourceProvider for the named module or requirement"""
356 module = sys.modules[moduleOrReq]
[all …]

12345678910>>...15