mirror of https://github.com/tiangolo/fastapi.git
🎨 Auto format
This commit is contained in:
parent
2d4fea9416
commit
caf894d7e8
|
|
@ -1,5 +1,5 @@
|
||||||
import re
|
import re
|
||||||
from typing import TypedDict, Union
|
from typing import TypedDict
|
||||||
|
|
||||||
CODE_INCLUDE_RE = re.compile(r"^\{\*\s*(\S+)\s*(.*)\*\}$")
|
CODE_INCLUDE_RE = re.compile(r"^\{\*\s*(\S+)\s*(.*)\*\}$")
|
||||||
CODE_INCLUDE_PLACEHOLDER = "<CODE_INCLUDE>"
|
CODE_INCLUDE_PLACEHOLDER = "<CODE_INCLUDE>"
|
||||||
|
|
@ -50,8 +50,8 @@ class MarkdownLinkInfo(TypedDict):
|
||||||
line_no: int
|
line_no: int
|
||||||
url: str
|
url: str
|
||||||
text: str
|
text: str
|
||||||
title: Union[str, None]
|
title: str | None
|
||||||
attributes: Union[str, None]
|
attributes: str | None
|
||||||
full_match: str
|
full_match: str
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -287,8 +287,8 @@ def _add_lang_code_to_url(url: str, lang_code: str) -> str:
|
||||||
def _construct_markdown_link(
|
def _construct_markdown_link(
|
||||||
url: str,
|
url: str,
|
||||||
text: str,
|
text: str,
|
||||||
title: Union[str, None],
|
title: str | None,
|
||||||
attributes: Union[str, None],
|
attributes: str | None,
|
||||||
lang_code: str,
|
lang_code: str,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""
|
"""
|
||||||
|
|
@ -549,7 +549,7 @@ def extract_multiline_code_blocks(text: list[str]) -> list[MultilineCodeBlockInf
|
||||||
return blocks
|
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)
|
match = HASH_COMMENT_RE.match(line)
|
||||||
if match:
|
if match:
|
||||||
code = match.group("code").rstrip()
|
code = match.group("code").rstrip()
|
||||||
|
|
@ -558,7 +558,7 @@ def _split_hash_comment(line: str) -> tuple[str, Union[str, None]]:
|
||||||
return line.rstrip(), 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)
|
match = SLASHES_COMMENT_RE.match(line)
|
||||||
if match:
|
if match:
|
||||||
code = match.group("code").rstrip()
|
code = match.group("code").rstrip()
|
||||||
|
|
@ -604,8 +604,8 @@ def replace_multiline_code_block(
|
||||||
|
|
||||||
code_block: list[str] = []
|
code_block: list[str] = []
|
||||||
for line_a, line_b in zip(block_a["content"], block_b["content"]):
|
for line_a, line_b in zip(block_a["content"], block_b["content"]):
|
||||||
line_a_comment: Union[str, None] = None
|
line_a_comment: str | None = None
|
||||||
line_b_comment: Union[str, None] = None
|
line_b_comment: str | None = None
|
||||||
|
|
||||||
# Handle comments based on language
|
# Handle comments based on language
|
||||||
if block_language in {
|
if block_language in {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue