From 9f0194de65b321785dee5320a1eba818d662c198 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+aa-turner@users.noreply.github.com> Date: Sun, 1 Dec 2024 09:30:55 +0000 Subject: [PATCH] Enable the RUF036 lint in Ruff --- .ruff.toml | 4 ++-- sphinx/util/logging.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.ruff.toml b/.ruff.toml index d952eb30b14..5efb7d35ac6 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -251,7 +251,7 @@ select = [ "RUF033", # `__post_init__` method with argument defaults "RUF034", # Useless `if`-`else` condition "RUF035", # Unsafe use of `{name}` detected -# "RUF036", # `None` not at the end of the type annotation. + "RUF036", # `None` not at the end of the type annotation. "RUF038", # `Literal[True, False, ...]` can be replaced with `Literal[...] | bool` # "RUF039", # First argument to {call} is not raw string "RUF040", # Non-string literal used as assert message @@ -367,7 +367,7 @@ select = [ ] # these tests need old ``typing`` generic aliases -"tests/test_util/test_util_typing.py" = ["UP006", "UP007", "UP035"] +"tests/test_util/test_util_typing.py" = ["RUF036", "UP006", "UP007", "UP035"] "tests/test_util/typing_test_data.py" = ["FA100", "I002", "PYI030", "UP006", "UP007", "UP035"] "utils/*" = [ diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py index 20293c8fabe..b40f49259b5 100644 --- a/sphinx/util/logging.py +++ b/sphinx/util/logging.py @@ -161,9 +161,9 @@ def warning( # type: ignore[override] self, msg: object, *args: object, - type: None | str = None, - subtype: None | str = None, - location: None | str | tuple[str | None, int | None] | Node = None, + type: str | None = None, + subtype: str | None = None, + location: str | tuple[str | None, int | None] | Node | None = None, nonl: bool = True, color: str | None = None, once: bool = False,