Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-120417: Fix "imported but unused" linter warnings #120461

Merged
merged 3 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/collections/abc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from _collections_abc import *
from _collections_abc import __all__
from _collections_abc import _CallableGenericAlias

__all__ = [*__all__, '_CallableGenericAlias']
vstinner marked this conversation as resolved.
Show resolved Hide resolved
9 changes: 9 additions & 0 deletions Lib/importlib/machinery.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,12 @@
def all_suffixes():
"""Returns a list of all recognized module suffixes for this process"""
return SOURCE_SUFFIXES + BYTECODE_SUFFIXES + EXTENSION_SUFFIXES


__all__ = ['ModuleSpec', 'BuiltinImporter', 'FrozenImporter',
'SOURCE_SUFFIXES', 'DEBUG_BYTECODE_SUFFIXES',
'OPTIMIZED_BYTECODE_SUFFIXES', 'BYTECODE_SUFFIXES',
'EXTENSION_SUFFIXES', 'WindowsRegistryFinder', 'PathFinder',
'FileFinder', 'SourceFileLoader', 'SourcelessFileLoader',
'ExtensionFileLoader', 'AppleFrameworkLoader', 'NamespaceLoader',
'all_suffixes']
7 changes: 7 additions & 0 deletions Lib/importlib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,3 +270,10 @@ def exec_module(self, module):
loader_state['is_loading'] = False
module.__spec__.loader_state = loader_state
module.__class__ = _LazyModule


__all__ = ['Loader', 'module_from_spec', '_resolve_name', 'spec_from_loader',
'_find_spec', 'MAGIC_NUMBER', '_RAW_MAGIC_NUMBER',
vstinner marked this conversation as resolved.
Show resolved Hide resolved
'cache_from_source', 'decode_source', 'source_from_cache',
'spec_from_file_location', 'source_hash', 'resolve_name',
'find_spec', 'LazyLoader']
2 changes: 1 addition & 1 deletion Lib/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

if _mswindows:
import _winapi
from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP,
from _winapi import (CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP, # noqa: F401
STD_INPUT_HANDLE, STD_OUTPUT_HANDLE,
STD_ERROR_HANDLE, SW_HIDE,
STARTF_USESTDHANDLES, STARTF_USESHOWWINDOW,
Expand Down
14 changes: 10 additions & 4 deletions Lib/xml/sax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

from .xmlreader import InputSource
from .handler import ContentHandler, ErrorHandler
from ._exceptions import SAXException, SAXNotRecognizedException, \
SAXParseException, SAXNotSupportedException, \
SAXReaderNotAvailable
from ._exceptions import (SAXException, SAXNotRecognizedException,
SAXParseException, SAXNotSupportedException,
SAXReaderNotAvailable)


def parse(source, handler, errorHandler=ErrorHandler()):
Expand Down Expand Up @@ -55,7 +55,7 @@ def parseString(string, handler, errorHandler=ErrorHandler()):
# tell modulefinder that importing sax potentially imports expatreader
_false = 0
if _false:
import xml.sax.expatreader
import xml.sax.expatreader # noqa: F401

import os, sys
if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ:
Expand Down Expand Up @@ -92,3 +92,9 @@ def make_parser(parser_list=()):
def _create_parser(parser_name):
drv_module = __import__(parser_name,{},{},['create_parser'])
return drv_module.create_parser()


__all__ = ['InputSource', 'ContentHandler', 'ErrorHandler', 'SAXException',
'SAXNotRecognizedException', 'SAXParseException',
'SAXNotSupportedException', 'SAXReaderNotAvailable', 'parse',
'parseString', 'make_parser', 'default_parser_list']
Loading