summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-06-14 18:39:50 (GMT)
committerGitHub <noreply@github.com>2024-06-14 18:39:50 (GMT)
commit05df063ad80becc1ba6bd07d67b55b5965f32375 (patch)
treef0c29d986aafdc49366a8627702e10dab54a887e /Lib/xml/sax
parented60ab5fab6d187068cb3e0f0d4192ebf3a228b7 (diff)
downloadcpython-05df063ad80becc1ba6bd07d67b55b5965f32375.zip
cpython-05df063ad80becc1ba6bd07d67b55b5965f32375.tar.gz
cpython-05df063ad80becc1ba6bd07d67b55b5965f32375.tar.bz2
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/xml/sax')
-rw-r--r--Lib/xml/sax/__init__.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/Lib/xml/sax/__init__.py b/Lib/xml/sax/__init__.py
index b657310..fe4582c 100644
--- a/Lib/xml/sax/__init__.py
+++ b/Lib/xml/sax/__init__.py
@@ -21,9 +21,9 @@ expatreader -- Driver that allows use of the Expat parser with SAX.
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()):
@@ -55,7 +55,7 @@ default_parser_list = ["xml.sax.expatreader"]
# 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:
@@ -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__ = ['ContentHandler', 'ErrorHandler', 'InputSource', 'SAXException',
+ 'SAXNotRecognizedException', 'SAXNotSupportedException',
+ 'SAXParseException', 'SAXReaderNotAvailable',
+ 'default_parser_list', 'make_parser', 'parse', 'parseString']