mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-22 10:40:46 +00:00
fix(token_counter): return a constant for an array param with no items
The previous commit reached the missing items case by recursing on an empty
dict. That dict has no type key, so _format_type falls through to its else
branch and returns the literal any, which makes the recursive call
indistinguishable from the constant while handing an untyped empty dict to an
unannotated parameter
basedpyright counts that call as reportUnknownArgumentType, and
scripts/type_check_gate.py fails any rule whose codebase-wide total grows past
its merge-base count, with only reportAny and reportExplicitAny exempt. The
codebase-wide total for this file now sits one below the merge-base count at
9621a60d27 instead of matching it, and the self-recursion is gone
Signed-off-by: Delweng <delweng@gmail.com>
This commit is contained in:
parent
3c5cb293d6
commit
05c8637ce6
1 changed files with 1 additions and 1 deletions
|
|
@ -1180,7 +1180,7 @@ def _format_type(props, indent):
|
|||
return "string"
|
||||
elif type == "array":
|
||||
if "items" not in props:
|
||||
return f"{_format_type({}, indent)}[]"
|
||||
return "any[]"
|
||||
return f"{_format_type(props['items'], indent)}[]"
|
||||
elif type == "object":
|
||||
return f"{{\n{_format_object_parameters(props, indent + 2)}\n}}"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue