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:
Harry Mellor
2026-09-16 16:44:29 +00:00
committed by GitHub
co-authored by Claude Opus 5
parent 804e5377aa
commit 8c1557a79c
2002 changed files with 15024 additions and 14269 deletions
+11 -7
View File
@@ -492,7 +492,8 @@ def test_extract_tool_calls_pre_v11_regex_fallback(
):
"""The regex fallback path finds valid JSON via regex when the primary
raw_decode fails on leading junk. It should re-serialize arguments
and return a valid tool call."""
and return a valid tool call.
"""
model_output = (
'[TOOL_CALLS] junk [{"name": "add", "arguments":{"a": 1, "b": 2}}] trail'
)
@@ -2003,7 +2004,8 @@ def test_streaming_pre_v11_parallel_calls_batched_deltas(
mistral_pre_v11_tool_parser, mistral_pre_v11_tokenizer, chunk_size, driver
):
"""A batched delta spanning the boundary between two parallel calls must
keep them on distinct indices (the bug collapsed both onto index 0)."""
keep them on distinct indices (the bug collapsed both onto index 0).
"""
model_output = (
'[TOOL_CALLS] [{"name": "add", "arguments": {"a": 3.5, "b": 4}}, '
'{"name": "get_current_weather", "arguments": '
@@ -2045,7 +2047,6 @@ def test_content_tool_calls_transition_emits_reasoning_end(
reasoning_encoding,
):
"""(CONTENT, TOOL_CALLS) must emit REASONING_END when reasoning is enabled."""
cfg = mistral_config(reasoning_encoding=reasoning_encoding)
engine = StreamingParserEngine(
config=cfg, tokenizer=mistral_tokenizer, vocab=mistral_tokenizer.get_vocab()
@@ -2122,7 +2123,8 @@ def test_reasoning_active_no_think_block_no_leak(
chunk_size,
):
"""Tool call without a preceding think block must not leak as content
when the reasoning parser is active."""
when the reasoning parser is active.
"""
accumulated_content = ""
function_names: list[str] = []
function_args_strs: list[str] = []
@@ -2219,11 +2221,12 @@ def test_adjust_request_pre_v11_required_clears_response_format(
mistral_pre_v11_tool_parser: MistralToolParser,
response_format: dict,
) -> None:
"""required + response_format must inject the tool schema and clear
"""Required + response_format must inject the tool schema and clear
response_format so the tool schema is the sole structured-output
constraint, matching the base ToolParser (otherwise the request either
hits the "multiple constraints" engine error or, with no constraint,
rambles to finish_reason='length')."""
rambles to finish_reason='length').
"""
request = _make_request(tool_choice="required", response_format=response_format)
result = mistral_pre_v11_tool_parser.adjust_request(request)
@@ -2240,7 +2243,8 @@ def test_adjust_request_non_mistral_tokenizer_required_injects_schema(
) -> None:
"""The guided-schema injection must also fire for non-Mistral (e.g. HF-mode)
tokenizers driving the Mistral tool parser, mirroring the base ToolParser so
required + response_format does not fall back to an unconstrained ramble."""
required + response_format does not fall back to an unconstrained ramble.
"""
request = _make_request(
tool_choice="required", response_format={"type": "json_object"}
)