Skip to content

Commit 3e4fdc9

Browse files
committed
fix: add type ignores for pyright compatibility
1 parent ec8bf54 commit 3e4fdc9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/replicate/lib/_files.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ def filter_none_values(obj: Any) -> Any: # noqa: ANN401
3333
The object with None values removed from all nested dictionaries.
3434
"""
3535
if isinstance(obj, dict):
36-
return {key: filter_none_values(value) for key, value in obj.items() if value is not None}
36+
return {
37+
key: filter_none_values(value)
38+
for key, value in obj.items() # type: ignore[misc]
39+
if value is not None
40+
}
3741
if isinstance(obj, (list, tuple)):
38-
return type(obj)(filter_none_values(item) for item in obj)
42+
return type(obj)(filter_none_values(item) for item in obj) # type: ignore[arg-type, misc]
3943
return obj
4044

4145

tests/test_filter_none_values.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ def test_encode_json_nested_none_filtering(client: Replicate):
9696
}
9797

9898

99-
async def test_async_encode_json_filters_none(async_client):
99+
async def test_async_encode_json_filters_none(async_client): # type: ignore[no-untyped-def]
100100
"""Test that async_encode_json filters None values from dicts."""
101101
input_dict = {"prompt": "banana", "seed": None, "width": 512}
102102
result = await async_encode_json(input_dict, async_client)
103103
assert result == {"prompt": "banana", "width": 512}
104104
assert "seed" not in result
105105

106106

107-
async def test_async_encode_json_nested_none_filtering(async_client):
107+
async def test_async_encode_json_nested_none_filtering(async_client): # type: ignore[no-untyped-def]
108108
"""Test that async_encode_json recursively filters None values."""
109109
input_dict = {
110110
"prompt": "banana",

0 commit comments

Comments
 (0)