[lint] follow PEP 8 for module-level dunder names (#12180)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
James Addison 2024-03-23 18:21:22 +00:00 committed by GitHub
parent 4b3c4abe0d
commit 42a0d73160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 264 additions and 261 deletions

View File

@ -31,3 +31,6 @@ exclude =
doc/_build/*, doc/_build/*,
sphinx/search/*, sphinx/search/*,
doc/usage/extensions/example*.py, doc/usage/extensions/example*.py,
per-file-ignores =
tests/test_extensions/ext_napoleon_pep526_data_google.py:MLL001,
tests/test_extensions/ext_napoleon_pep526_data_numpy.py:MLL001,

View File

@ -1,5 +1,8 @@
"""The Sphinx documentation toolchain.""" """The Sphinx documentation toolchain."""
__version__ = '7.3.0'
__display_version__ = __version__ # used for command line version
# Keep this file executable as-is in Python 3! # Keep this file executable as-is in Python 3!
# (Otherwise getting the version out of it when packaging is impossible.) # (Otherwise getting the version out of it when packaging is impossible.)
@ -17,9 +20,6 @@ warnings.filterwarnings(
'ignore', 'The frontend.Option class .*', DeprecationWarning, module='docutils.frontend' 'ignore', 'The frontend.Option class .*', DeprecationWarning, module='docutils.frontend'
) )
__version__ = '7.3.0'
__display_version__ = __version__ # used for command line version
#: Version info for better programmatic use. #: Version info for better programmatic use.
#: #:
#: A tuple of five elements; for Sphinx version 1.2.1 beta 3 this would be #: A tuple of five elements; for Sphinx version 1.2.1 beta 3 this would be

View File

@ -1,7 +1,3 @@
from __future__ import annotations
import re
""" """
Important note on ids Important note on ids
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
@ -254,6 +250,10 @@ import re
nested-name nested-name
""" """
from __future__ import annotations
import re
udl_identifier_re = re.compile(r''' udl_identifier_re = re.compile(r'''
[a-zA-Z_][a-zA-Z0-9_]*\b # note, no word boundary in the beginning [a-zA-Z_][a-zA-Z0-9_]*\b # note, no word boundary in the beginning
''', re.VERBOSE) ''', re.VERBOSE)

View File

@ -2,6 +2,8 @@
from __future__ import annotations from __future__ import annotations
__all__ = ()
import base64 import base64
import contextlib import contextlib
import re import re
@ -40,8 +42,6 @@ logger = logging.getLogger(__name__)
templates_path = path.join(package_dir, 'templates', 'imgmath') templates_path = path.join(package_dir, 'templates', 'imgmath')
__all__ = ()
class MathExtError(SphinxError): class MathExtError(SphinxError):
category = 'Math extension error' category = 'Math extension error'

View File

@ -2,6 +2,8 @@
from __future__ import annotations from __future__ import annotations
__all__ = ('SphinxTestApp', 'SphinxTestAppWrapperForSkipBuilding')
import contextlib import contextlib
import os import os
import re import re
@ -27,8 +29,6 @@ if TYPE_CHECKING:
from docutils.nodes import Node from docutils.nodes import Node
__all__ = 'SphinxTestApp', 'SphinxTestAppWrapperForSkipBuilding'
def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) -> None: def assert_node(node: Node, cls: Any = None, xpath: str = "", **kwargs: Any) -> None:
if cls: if cls:

View File

@ -2,6 +2,8 @@
from __future__ import annotations from __future__ import annotations
__all__ = ('Theme', 'HTMLThemeFactory')
import configparser import configparser
import contextlib import contextlib
import os import os
@ -27,8 +29,6 @@ else:
if TYPE_CHECKING: if TYPE_CHECKING:
from sphinx.application import Sphinx from sphinx.application import Sphinx
__all__ = 'Theme', 'HTMLThemeFactory'
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
_NO_DEFAULT = object() _NO_DEFAULT = object()