[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/*,
sphinx/search/*,
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."""
__version__ = '7.3.0'
__display_version__ = __version__ # used for command line version
# Keep this file executable as-is in Python 3!
# (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'
)
__version__ = '7.3.0'
__display_version__ = __version__ # used for command line version
#: Version info for better programmatic use.
#:
#: 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
----------------------------------------------------------------------------
@ -254,6 +250,10 @@ import re
nested-name
"""
from __future__ import annotations
import re
udl_identifier_re = re.compile(r'''
[a-zA-Z_][a-zA-Z0-9_]*\b # note, no word boundary in the beginning
''', re.VERBOSE)

View File

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

View File

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

View File

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