8000 gh-126609: Revert Availability Directive changes by StanFromIreland · Pull Request #129480 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-126609: Revert Availability Directive changes #129480

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

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
8000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up Lint
  • Loading branch information
StanFromIreland committed Jan 30, 2025
commit 1a95fb618c0823bed5e8670ead72825bed181006
6 changes: 5 additions & 1 deletion Doc/tools/extensions/availability.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Support for documenting platform availability"""

from __future__ import annotations
from docutils import nodes
from sphinx import addnodes

Check failure on line 5 in Doc/tools/extensions/availability.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F401)

Doc/tools/extensions/availability.py:5:20: F401 `sphinx.addnodes` imported but unused
from sphinx.util import logging
from sphinx.util.docutils import SphinxDirective


class Availability(SphinxDirective):

Check failure on line 10 in Doc/tools/extensions/availability.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (I001)

Doc/tools/extensions/availability.py:3:1: I001 Import block is un-sorted or un-formatted

has_content = True
required_arguments = 1
optional_arguments = 0
Expand Down Expand Up @@ -42,10 +42,14 @@

def parse_platforms(self):
"""Parse platform information from arguments

Arguments is a comma-separated string of platforms. A platform may
be prefixed with "not " to indicate that a feature is not available.

Example::

.. availability:: Windows, Linux >= 4.2, not WASI

Arguments like "Linux >= 3.17 with glibc >= 2.27" are currently not
parsed into separate tokens.
"""
Expand All @@ -65,16 +69,16 @@
cls = type(self)
logger = logging.getLogger(cls.__qualname__)
logger.warning(
f"Unknown platform(s) or syntax '{' '.join(sorted(unknown))}' "
f"in '.. availability:: {self.arguments[0]}', see "
f"{__file__}:{cls.__qualname__}.known_platforms for a set "
"known platforms."

Check failure on line 75 in Doc/tools/extensions/availability.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (G004)

Doc/tools/extensions/availability.py:72:17: G004 Logging statement uses f-string
)

return platforms


def setup(app: Sphinx) -> ExtensionMetadata:

Check failure on line 81 in Doc/tools/extensions/availability.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F821)

Doc/tools/extensions/availability.py:81:16: F821 Undefined name `Sphinx`

Check failure on line 81 in Doc/tools/extensions/availability.py

View workflow job for this annotation

GitHub Actions / lint

Ruff (F821)

Doc/tools/extensions/availability.py:81:27: F821 Undefined name `ExtensionMetadata`
app.add_directive("availability", Availability)

return {
Expand Down
Loading
0