Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
@@ -416,7 +416,8 @@ def test_tool_call(
|
||||
def test_empty_tool_call_block(body: str, lfm2_tokenizer: TokenizerLike):
|
||||
"""An empty block ([] or [ ]) means the model called no tools; it must
|
||||
not report tools_called=True with zero tool calls (the invariant
|
||||
run_tool_extraction asserts)."""
|
||||
run_tool_extraction asserts).
|
||||
"""
|
||||
cls = ToolParserManager.get_tool_parser("lfm2")
|
||||
model_output = f"{TOOL_CALL_START}[{body}]{TOOL_CALL_END}"
|
||||
|
||||
@@ -436,7 +437,8 @@ def test_whitespace_after_start_token(lfm2_tokenizer: TokenizerLike):
|
||||
not break parsing. The streaming path used to feed the indented text to
|
||||
ast.parse verbatim, so every completion candidate raised
|
||||
IndentationError and the call was silently dropped (non-streaming
|
||||
stripped it and succeeded)."""
|
||||
stripped it and succeeded).
|
||||
"""
|
||||
cls = ToolParserManager.get_tool_parser("lfm2")
|
||||
model_output = f"{TOOL_CALL_START} [{SIMPLE_FUNCTION_OUTPUT}]{TOOL_CALL_END}"
|
||||
|
||||
@@ -476,7 +478,8 @@ def test_streaming_full_block_and_trailing_in_single_delta(
|
||||
):
|
||||
"""The entire <|tool_call_start|>[...]<|tool_call_end|> block plus
|
||||
trailing assistant text arrive in one delta. Trailing content must
|
||||
still be emitted — not silently dropped."""
|
||||
still be emitted — not silently dropped.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
full_text = f"{TOOL_CALL_START}[{SIMPLE_FUNCTION_OUTPUT}]{TOOL_CALL_END}\nDone."
|
||||
|
||||
@@ -491,7 +494,8 @@ def test_streaming_leading_content_and_full_block_in_single_delta(
|
||||
lfm2_tokenizer: TokenizerLike,
|
||||
):
|
||||
"""Leading assistant text plus the entire tool block arrive in one
|
||||
delta. Leading content must be emitted — not silently dropped."""
|
||||
delta. Leading content must be emitted — not silently dropped.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
full_text = (
|
||||
f"Let me check. {TOOL_CALL_START}[{SIMPLE_FUNCTION_OUTPUT}]{TOOL_CALL_END}"
|
||||
@@ -508,7 +512,8 @@ def test_streaming_leading_block_and_trailing_in_single_delta(
|
||||
lfm2_tokenizer: TokenizerLike,
|
||||
):
|
||||
"""Leading text + complete tool block + trailing text in one delta.
|
||||
Both leading and trailing content must be preserved."""
|
||||
Both leading and trailing content must be preserved.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
full_text = (
|
||||
"Let me check. "
|
||||
@@ -529,7 +534,8 @@ def test_echoed_tool_call_body_not_leaked_to_content(
|
||||
"""LFM2 sometimes emits the tool call body again after the first
|
||||
<|tool_call_end|>, capped with a second <|tool_call_end|>. The
|
||||
echoed body must not surface as assistant content — neither in
|
||||
streaming nor non-streaming paths."""
|
||||
streaming nor non-streaming paths.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
body = (
|
||||
"[grocery.orderIngredients("
|
||||
@@ -564,7 +570,8 @@ def test_streaming_char_by_char_multi_dict_list(lfm2_tokenizer: TokenizerLike):
|
||||
character at a time. Every prefix lands in some partial-parse state
|
||||
(mid-key, mid-value, open quote inside dict, empty dict, etc.). The
|
||||
parser must not raise — incomplete prefixes should silently wait for
|
||||
more text instead of logging exceptions."""
|
||||
more text instead of logging exceptions.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
full_text = (
|
||||
f"{TOOL_CALL_START}[grocery.orderIngredients("
|
||||
@@ -595,7 +602,8 @@ def test_streaming_char_by_char_multi_dict_list(lfm2_tokenizer: TokenizerLike):
|
||||
def test_streaming_dotted_name_in_single_delta(lfm2_tokenizer: TokenizerLike):
|
||||
"""A pythonic call with a dotted/attribute function name (e.g.
|
||||
``domain.method(arg=...)``) must be parsed correctly in streaming mode
|
||||
just as in non-streaming mode."""
|
||||
just as in non-streaming mode.
|
||||
"""
|
||||
tool_parser: ToolParser = ToolParserManager.get_tool_parser("lfm2")(lfm2_tokenizer)
|
||||
full_text = f"{TOOL_CALL_START}[{DOTTED_NAME_FUNCTION_OUTPUT}]{TOOL_CALL_END}"
|
||||
|
||||
@@ -611,7 +619,8 @@ def test_adjust_request_disables_skip_special_tokens(
|
||||
"""When tools are present, the parser must force
|
||||
``skip_special_tokens=False`` so the engine does not strip the
|
||||
<|tool_call_start|>/<|tool_call_end|> sentinels before they reach the
|
||||
parser."""
|
||||
parser.
|
||||
"""
|
||||
from vllm.entrypoints.openai.chat_completion.protocol import (
|
||||
ChatCompletionRequest,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user