This commit is contained in:
Vladimir 2026-02-13 15:28:47 +00:00 committed by GitHub
commit 964a36d55a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 13 deletions

View File

@ -436,9 +436,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:

View File

@ -502,6 +502,7 @@ select = [
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
"FURB" # refurb
]
ignore = [
"E501", # line too long, handled by black

View File

@ -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 = "<CODE_INCLUDE>"
@ -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()
@ -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}). "
@ -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 {