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
@@ -56,8 +56,7 @@ def partial_tag_overlap(text: str, tag: str) -> int:
|
||||
|
||||
|
||||
def find_common_prefix(s1: str, s2: str) -> str:
|
||||
"""
|
||||
Finds a common prefix that is shared between two strings, if there is one.
|
||||
"""Finds a common prefix that is shared between two strings, if there is one.
|
||||
Order of arguments is NOT important.
|
||||
|
||||
This function is provided as a UTILITY for extracting information from JSON
|
||||
@@ -79,8 +78,7 @@ def find_common_prefix(s1: str, s2: str) -> str:
|
||||
|
||||
|
||||
def find_common_suffix(s1: str, s2: str) -> str:
|
||||
"""
|
||||
Finds a common suffix shared between two strings, if there is one. Order of
|
||||
"""Finds a common suffix shared between two strings, if there is one. Order of
|
||||
arguments is NOT important.
|
||||
Stops when the suffix ends OR it hits an alphanumeric character
|
||||
|
||||
@@ -97,8 +95,7 @@ def find_common_suffix(s1: str, s2: str) -> str:
|
||||
|
||||
|
||||
def extract_intermediate_diff(curr: str, old: str) -> str:
|
||||
"""
|
||||
Given two strings, extract the difference in the middle between two strings
|
||||
"""Given two strings, extract the difference in the middle between two strings
|
||||
that are known to have a common prefix and/or suffix.
|
||||
|
||||
This function is provided as a UTILITY for extracting information from JSON
|
||||
@@ -429,7 +426,8 @@ def get_json_schema_from_tools(
|
||||
|
||||
class UnexpectedAstError(Exception):
|
||||
"""Raised when the AST structure does not match the expected
|
||||
pythonic tool call format."""
|
||||
pythonic tool call format.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@@ -450,6 +448,7 @@ def get_parameter_value(val: ast.expr) -> Any:
|
||||
|
||||
Raises:
|
||||
UnexpectedAstError: If the AST node is not a supported literal type.
|
||||
|
||||
"""
|
||||
if isinstance(val, ast.Constant):
|
||||
if val.value is None or isinstance(val.value, (str, int, float)):
|
||||
@@ -528,6 +527,7 @@ def _ast_callable_dotted_name(node: ast.expr) -> str:
|
||||
Raises:
|
||||
UnexpectedAstError: If the chain does not bottom out in an
|
||||
``ast.Name`` (e.g. subscript or call expression as receiver).
|
||||
|
||||
"""
|
||||
parts: list[str] = []
|
||||
current: ast.expr = node
|
||||
@@ -550,6 +550,7 @@ def handle_single_tool(call: ast.Call) -> ToolCall:
|
||||
Raises:
|
||||
UnexpectedAstError: If the call target is neither a simple name
|
||||
nor a chain of attribute accesses bottoming out in a name.
|
||||
|
||||
"""
|
||||
if not isinstance(call.func, (ast.Name, ast.Attribute)):
|
||||
logger.warning(
|
||||
@@ -921,6 +922,7 @@ def make_valid_python(text: str) -> tuple[str, str] | None:
|
||||
Raises:
|
||||
UnexpectedAstError: If mismatched brackets or parentheses
|
||||
are detected.
|
||||
|
||||
"""
|
||||
bracket_stack: list[str] = []
|
||||
for index, char in enumerate(text):
|
||||
@@ -1088,6 +1090,7 @@ def coerce_to_schema_type(value: str, schema_type: str | list[str]) -> Any:
|
||||
value: The raw string value from the model output.
|
||||
schema_type: One or more JSON Schema type strings
|
||||
(e.g. ``"string"`` or ``["string", "null"]``).
|
||||
|
||||
"""
|
||||
if isinstance(schema_type, str):
|
||||
schema_type = [schema_type]
|
||||
@@ -1176,6 +1179,7 @@ def compute_tool_delta(
|
||||
Returns:
|
||||
A DeltaToolCall with only the new argument characters, or None
|
||||
if there is no difference from what was previously sent.
|
||||
|
||||
"""
|
||||
new_call_args = new_call.function.arguments
|
||||
if withheld_suffix:
|
||||
|
||||
Reference in New Issue
Block a user