diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:39 +0300 |
commit | a6a92afe03e02795227d2641b49819b687f088f8 (patch) | |
tree | f6984a1d27d5a7ec88a6fdd6e20cd5b7693b6ece /library/python/runtime_py3/importer.pxi | |
parent | c6dc8b8bd530985bc4cce0137e9a5de32f1087cb (diff) | |
download | ydb-a6a92afe03e02795227d2641b49819b687f088f8.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/python/runtime_py3/importer.pxi')
-rw-r--r-- | library/python/runtime_py3/importer.pxi | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/library/python/runtime_py3/importer.pxi b/library/python/runtime_py3/importer.pxi index 904f94dea2..643776519e 100644 --- a/library/python/runtime_py3/importer.pxi +++ b/library/python/runtime_py3/importer.pxi @@ -249,7 +249,7 @@ class ResourceImporter(object): if isinstance(relpath, bytes): relpath = _s(relpath) return relpath or modname - + # PEP-302 extension 3 of 3: packaging introspection. # Used by `linecache` (while printing tracebacks) unless module filename # exists on the filesystem. @@ -265,7 +265,7 @@ class ResourceImporter(object): return _s(file_bytes(abspath)) data = resfs_read(mod_path(fullname)) return _s(data) if data else '' - + def get_code(self, fullname): modname = fullname if self.is_package(fullname): @@ -283,14 +283,14 @@ class ResourceImporter(object): yapyc_data = resfs_read(yapyc_path, builtin=True) if yapyc_data: return marshal.loads(yapyc_data) - else: + else: py_data = resfs_read(path, builtin=True) if py_data: return compile(py_data, _s(relpath), 'exec', dont_inherit=True) else: # This covers packages with no __init__.py in resources. return compile('', modname, 'exec', dont_inherit=True) - + def is_package(self, fullname): if fullname in self.memory: return False @@ -332,7 +332,7 @@ class ResourceImporter(object): if self.arcadia_source_finder: for m in self.arcadia_source_finder.iter_modules(self._package_prefix, prefix): yield m - + def get_resource_reader(self, fullname): try: if not self.is_package(fullname): @@ -393,7 +393,7 @@ class BuiltinSubmoduleImporter(BuiltinImporter): else: return None - + class ArcadiaSourceFinder: """ Search modules and packages in arcadia source tree. @@ -522,17 +522,17 @@ class ArcadiaSourceFinder: paths.add(rel_path) -def excepthook(*args, **kws): - # traceback module cannot be imported at module level, because interpreter - # is not fully initialized yet - - import traceback - - return traceback.print_exception(*args, **kws) - - +def excepthook(*args, **kws): + # traceback module cannot be imported at module level, because interpreter + # is not fully initialized yet + + import traceback + + return traceback.print_exception(*args, **kws) + + importer = ResourceImporter() - + def executable_path_hook(path): if path == executable: @@ -562,10 +562,10 @@ sys.path_importer_cache[executable] = importer # Indicator that modules and resources are built-in rather than on the file system. sys.is_standalone_binary = True sys.frozen = True - + # Set of names of importable modules. sys.extra_modules = importer.memory - -# Use custom implementation of traceback printer. -# Built-in printer (PyTraceBack_Print) does not support custom module loaders -sys.excepthook = excepthook + +# Use custom implementation of traceback printer. +# Built-in printer (PyTraceBack_Print) does not support custom module loaders +sys.excepthook = excepthook |