From 425e4f5cead8c4efc8de158ef90a2ae4bd11b5c2 Mon Sep 17 00:00:00 2001 From: vyuroshchin <> Date: Sat, 7 Feb 2026 23:08:46 +0300 Subject: [PATCH 1/4] add FURB ruff rule --- fastapi/routing.py | 4 +--- pyproject.toml | 17 +++++++++-------- scripts/doc_parsing_utils.py | 2 +- uv.lock | 8 ++++---- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/fastapi/routing.py b/fastapi/routing.py index 0b4d28873..ef99992f8 100644 --- a/fastapi/routing.py +++ b/fastapi/routing.py @@ -438,9 +438,7 @@ def get_request_handler( } # If status_code was set, use it, otherwise use the default from the # response class, in the case of redirect it's 307 - current_status_code = ( - status_code if status_code else solved_result.response.status_code - ) + current_status_code = status_code or solved_result.response.status_code if current_status_code is not None: response_args["status_code"] = current_status_code if solved_result.response.status_code: diff --git a/pyproject.toml b/pyproject.toml index 4895c2d34..7fdf529dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,7 +152,7 @@ docs = [ ] docs-tests = [ "httpx >=0.23.0,<1.0.0", - "ruff >=0.14.14", + "ruff >=0.15.0", ] github-actions = [ "httpx >=0.27.0,<1.0.0", @@ -288,13 +288,14 @@ show_contexts = true [tool.ruff.lint] select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "UP", # pyupgrade + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "UP", # pyupgrade + "FURB" # refurb ] ignore = [ "E501", # line too long, handled by black diff --git a/scripts/doc_parsing_utils.py b/scripts/doc_parsing_utils.py index 79f2e9ec0..d38d30c0f 100644 --- a/scripts/doc_parsing_utils.py +++ b/scripts/doc_parsing_utils.py @@ -594,7 +594,7 @@ def replace_multiline_code_block( ) block_language = block_a["lang"].lower() - if block_language in {"mermaid"}: + if block_language == "mermaid": if block_a != block_b: print( f"Skipping mermaid code block replacement (lines {start_line}-{end_line_no}). " diff --git a/uv.lock b/uv.lock index 9a807f8b4..5119b6001 100644 --- a/uv.lock +++ b/uv.lock @@ -1587,7 +1587,7 @@ dev = [ { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "typer", specifier = ">=0.21.1" }, @@ -1610,12 +1610,12 @@ docs = [ { name = "pillow", specifier = ">=11.3.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "typer", specifier = ">=0.21.1" }, ] docs-tests = [ { name = "httpx", specifier = ">=0.23.0,<1.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, ] github-actions = [ { name = "httpx", specifier = ">=0.27.0,<1.0.0" }, @@ -1639,7 +1639,7 @@ tests = [ { name = "pytest", specifier = ">=7.1.3,<9.0.0" }, { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.14.14" }, + { name = "ruff", specifier = ">=0.15.0" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "types-orjson", specifier = ">=3.6.2" }, From caf894d7e8369ea9cc8aa6e36835796c8e98642b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 12 Feb 2026 18:22:53 +0000 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/doc_parsing_utils.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/doc_parsing_utils.py b/scripts/doc_parsing_utils.py index d38d30c0f..fea95669b 100644 --- a/scripts/doc_parsing_utils.py +++ b/scripts/doc_parsing_utils.py @@ -1,5 +1,5 @@ import re -from typing import TypedDict, Union +from typing import TypedDict CODE_INCLUDE_RE = re.compile(r"^\{\*\s*(\S+)\s*(.*)\*\}$") CODE_INCLUDE_PLACEHOLDER = "" @@ -50,8 +50,8 @@ class MarkdownLinkInfo(TypedDict): line_no: int url: str text: str - title: Union[str, None] - attributes: Union[str, None] + title: str | None + attributes: str | None full_match: str @@ -287,8 +287,8 @@ def _add_lang_code_to_url(url: str, lang_code: str) -> str: def _construct_markdown_link( url: str, text: str, - title: Union[str, None], - attributes: Union[str, None], + title: str | None, + attributes: str | None, lang_code: str, ) -> str: """ @@ -549,7 +549,7 @@ def extract_multiline_code_blocks(text: list[str]) -> list[MultilineCodeBlockInf return blocks -def _split_hash_comment(line: str) -> tuple[str, Union[str, None]]: +def _split_hash_comment(line: str) -> tuple[str, str | None]: match = HASH_COMMENT_RE.match(line) if match: code = match.group("code").rstrip() @@ -558,7 +558,7 @@ def _split_hash_comment(line: str) -> tuple[str, Union[str, None]]: return line.rstrip(), None -def _split_slashes_comment(line: str) -> tuple[str, Union[str, None]]: +def _split_slashes_comment(line: str) -> tuple[str, str | None]: match = SLASHES_COMMENT_RE.match(line) if match: code = match.group("code").rstrip() @@ -604,8 +604,8 @@ def replace_multiline_code_block( code_block: list[str] = [] for line_a, line_b in zip(block_a["content"], block_b["content"]): - line_a_comment: Union[str, None] = None - line_b_comment: Union[str, None] = None + line_a_comment: str | None = None + line_b_comment: str | None = None # Handle comments based on language if block_language in { From 232faf11d952403663cb1f718e22556955a6ace6 Mon Sep 17 00:00:00 2001 From: Vladimir <51440383+even-even@users.noreply.github.com> Date: Thu, 12 Feb 2026 21:30:30 +0300 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com> --- pyproject.toml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c46b6a2c3..9823e5abf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,7 +151,7 @@ docs = [ ] docs-tests = [ "httpx >=0.23.0,<1.0.0", - "ruff >=0.15.0", + "ruff >=0.14.14", ] github-actions = [ "httpx >=0.27.0,<1.0.0", @@ -495,13 +495,13 @@ show_contexts = true [tool.ruff.lint] select = [ - "E", # pycodestyle errors - "W", # pycodestyle warnings - "F", # pyflakes - "I", # isort - "B", # flake8-bugbear - "C4", # flake8-comprehensions - "UP", # pyupgrade + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort + "B", # flake8-bugbear + "C4", # flake8-comprehensions + "UP", # pyupgrade "FURB" # refurb ] ignore = [ From 2fa86d6ae955502d3fcbbc4f39fe256b73228af5 Mon Sep 17 00:00:00 2001 From: vyuroshchin <> Date: Thu, 12 Feb 2026 21:39:07 +0300 Subject: [PATCH 4/4] fix lockfile --- uv.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/uv.lock b/uv.lock index 2562b5fd2..736b0e145 100644 --- a/uv.lock +++ b/uv.lock @@ -1280,7 +1280,7 @@ dev = [ { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.15.0" }, + { name = "ruff", specifier = ">=0.14.14" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "typer", specifier = ">=0.21.1" }, @@ -1303,12 +1303,12 @@ docs = [ { name = "pillow", specifier = ">=11.3.0" }, { name = "python-slugify", specifier = ">=8.0.4" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.15.0" }, + { name = "ruff", specifier = ">=0.14.14" }, { name = "typer", specifier = ">=0.21.1" }, ] docs-tests = [ { name = "httpx", specifier = ">=0.23.0,<1.0.0" }, - { name = "ruff", specifier = ">=0.15.0" }, + { name = "ruff", specifier = ">=0.14.14" }, ] github-actions = [ { name = "httpx", specifier = ">=0.27.0,<1.0.0" }, @@ -1332,7 +1332,7 @@ tests = [ { name = "pytest", specifier = ">=7.1.3,<9.0.0" }, { name = "pytest-codspeed", specifier = ">=4.2.0" }, { name = "pyyaml", specifier = ">=5.3.1,<7.0.0" }, - { name = "ruff", specifier = ">=0.15.0" }, + { name = "ruff", specifier = ">=0.14.14" }, { name = "sqlmodel", specifier = ">=0.0.31" }, { name = "strawberry-graphql", specifier = ">=0.200.0,<1.0.0" }, { name = "types-orjson", specifier = ">=3.6.2" },