aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/importlib
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-06-14 20:39:50 +0200
committerGitHub <noreply@github.com>2024-06-14 20:39:50 +0200
commit05df063ad80becc1ba6bd07d67b55b5965f32375 (patch)
treef0c29d986aafdc49366a8627702e10dab54a887e /Lib/importlib
parented60ab5fab6d187068cb3e0f0d4192ebf3a228b7 (diff)
downloadcpython-05df063ad80becc1ba6bd07d67b55b5965f32375.tar.gz
cpython-05df063ad80becc1ba6bd07d67b55b5965f32375.zip
gh-120417: Fix "imported but unused" linter warnings (#120461)
Add __all__ to the following modules: importlib.machinery, importlib.util and xml.sax. Add also "# noqa: F401" in collections.abc, subprocess and xml.sax. * Sort __all__; remove collections.abc.__all__; remove private names * Add tests
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/machinery.py8
-rw-r--r--Lib/importlib/util.py6
2 files changed, 14 insertions, 0 deletions
diff --git a/Lib/importlib/machinery.py b/Lib/importlib/machinery.py
index fbd30b159fb..6e294d59bfd 100644
--- a/Lib/importlib/machinery.py
+++ b/Lib/importlib/machinery.py
@@ -19,3 +19,11 @@ from ._bootstrap_external import NamespaceLoader
def all_suffixes():
"""Returns a list of all recognized module suffixes for this process"""
return SOURCE_SUFFIXES + BYTECODE_SUFFIXES + EXTENSION_SUFFIXES
+
+
+__all__ = ['AppleFrameworkLoader', 'BYTECODE_SUFFIXES', 'BuiltinImporter',
+ 'DEBUG_BYTECODE_SUFFIXES', 'EXTENSION_SUFFIXES',
+ 'ExtensionFileLoader', 'FileFinder', 'FrozenImporter', 'ModuleSpec',
+ 'NamespaceLoader', 'OPTIMIZED_BYTECODE_SUFFIXES', 'PathFinder',
+ 'SOURCE_SUFFIXES', 'SourceFileLoader', 'SourcelessFileLoader',
+ 'WindowsRegistryFinder', 'all_suffixes']
diff --git a/Lib/importlib/util.py b/Lib/importlib/util.py
index c94a148e4c5..7243d052cc2 100644
--- a/Lib/importlib/util.py
+++ b/Lib/importlib/util.py
@@ -270,3 +270,9 @@ class LazyLoader(Loader):
loader_state['is_loading'] = False
module.__spec__.loader_state = loader_state
module.__class__ = _LazyModule
+
+
+__all__ = ['LazyLoader', 'Loader', 'MAGIC_NUMBER',
+ 'cache_from_source', 'decode_source', 'find_spec',
+ 'module_from_spec', 'resolve_name', 'source_from_cache',
+ 'source_hash', 'spec_from_file_location', 'spec_from_loader']