mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-04 02:31:27 +00:00
Fix mutable default argument in check_if_part_exists_in_parts
Use None as default and initialize empty list inside the function to prevent mutable default argument anti-pattern.
This commit is contained in:
parent
59ea2a5792
commit
490390a057
1 changed files with 3 additions and 1 deletions
|
|
@ -613,11 +613,13 @@ def _get_equivalent_key(key: str, available_keys: set) -> str | None:
|
|||
return None
|
||||
|
||||
|
||||
def check_if_part_exists_in_parts(parts: list[PartType], part: PartType, excluded_keys: list[str] = []) -> bool:
|
||||
def check_if_part_exists_in_parts(parts: list[PartType], part: PartType, excluded_keys: list[str] | None = None) -> bool:
|
||||
"""
|
||||
Check if a part exists in a list of parts
|
||||
Handles both camelCase and snake_case key variations (e.g., function_call vs functionCall)
|
||||
"""
|
||||
if excluded_keys is None:
|
||||
excluded_keys = []
|
||||
keys_to_compare: Final = set(part.keys()) - set(excluded_keys)
|
||||
for p in parts:
|
||||
p_keys = set(p.keys())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue