Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0284ce8

Browse filesBrowse files
authored
gh-154675: reorganize some imports in importlib (#154657)
1 parent 85c8bce commit 0284ce8
Copy full SHA for 0284ce8

3 files changed

+18-9Lines changed: 18 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Lib/importlib/abc.py‎

Copy file name to clipboardExpand all lines: Lib/importlib/abc.py
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Abstract base classes related to import."""
22
from . import _bootstrap_external
33
from . import machinery
4+
45
try:
56
import _frozen_importlib
67
except ImportError as exc:
@@ -11,10 +12,12 @@
1112
import _frozen_importlib_external
1213
except ImportError:
1314
_frozen_importlib_external = _bootstrap_external
14-
from ._abc import Loader
1515
import abc
1616

1717

18+
# Public API
19+
from ._abc import Loader
20+
1821
__all__ = [
1922
'Loader', 'MetaPathFinder', 'PathEntryFinder',
2023
'ResourceLoader', 'InspectLoader', 'ExecutionLoader',
Collapse file

‎Lib/importlib/machinery.py‎

Copy file name to clipboardExpand all lines: Lib/importlib/machinery.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"""The machinery of importlib: finders, loaders, hooks, etc."""
22

3+
lazy import warnings
4+
5+
6+
# Public API
37
from ._bootstrap import ModuleSpec
48
from ._bootstrap import BuiltinImporter
59
from ._bootstrap import FrozenImporter
@@ -33,8 +37,6 @@ def all_suffixes():
3337

3438

3539
def __getattr__(name):
36-
import warnings
37-
3840
if name == 'DEBUG_BYTECODE_SUFFIXES':
3941
warnings.warn('importlib.machinery.DEBUG_BYTECODE_SUFFIXES is '
4042
'deprecated; use importlib.machinery.BYTECODE_SUFFIXES '
Collapse file

‎Lib/importlib/util.py‎

Copy file name to clipboardExpand all lines: Lib/importlib/util.py
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
"""Utility code for constructing importers, etc."""
2+
3+
from ._bootstrap import _resolve_name
4+
from ._bootstrap import _find_spec
5+
6+
import _imp
7+
import sys
8+
import types
9+
10+
11+
# Public API
212
from ._abc import Loader
313
from ._bootstrap import module_from_spec
4-
from ._bootstrap import _resolve_name
514
from ._bootstrap import spec_from_loader
6-
from ._bootstrap import _find_spec
715
from ._bootstrap_external import MAGIC_NUMBER
816
from ._bootstrap_external import cache_from_source
917
from ._bootstrap_external import decode_source
1018
from ._bootstrap_external import source_from_cache
1119
from ._bootstrap_external import spec_from_file_location
1220

13-
import _imp
14-
import sys
15-
import types
16-
1721

1822
def source_hash(source_bytes):
1923
"Return the hash of *source_bytes* as used in hash-based pyc files."

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.