Skip to content

Commit 73470de

Browse files
committed
fix some bad linter changes
1 parent a73cbcf commit 73470de

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/transformers/utils/chat_template_utils.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,10 @@
6262
# Splits the Args: block into individual arguments
6363
args_split_re = re.compile(
6464
r"""
65-
(?:^|\n) # Start of the args block or a newline
66-
\s*(\w+) # Capture the argument name
67-
(?:\s*\([^)]*\))? # Optional (type) with optional surrounding spaces
68-
\s*:\s* # Colon (allowing spaces around it)
69-
(.*?)\s* # Capture the description (multi-line), trim trailing spaces
70-
(?=\n\s*\w+(?:\s*\([^)]*\))?\s*:|\Z) # Next arg (optionally with type) or end
71-
65+
(?:^|\n) # Match the start of the args block, or a newline
66+
\s*(\w+):\s* # Capture the argument name and strip spacing
67+
(.*?)\s* # Capture the argument description, which can span multiple lines, and strip trailing spacing
68+
(?=\n\s*\w+:|\Z) # Stop when you hit the next argument or the end of the block
7269
""",
7370
re.DOTALL | re.VERBOSE,
7471
)
@@ -104,7 +101,7 @@ def _get_json_schema_type(param_type: type) -> dict[str, str]:
104101
return type_mapping.get(param_type, {"type": "object"})
105102

106103

107-
def _parse_type_hint(hint) -> dict:
104+
def _parse_type_hint(hint: str) -> dict:
108105
origin = get_origin(hint)
109106
args = get_args(hint)
110107

0 commit comments

Comments
 (0)