Skip to content

Commit

Permalink
fix mypy 1.12 typing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Oct 14, 2024
1 parent 65364ff commit 57a6719
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/inspect_ai/dataset/_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
Any,
Callable,
Iterator,
Optional,
Sequence,
Union,
overload,
Expand Down Expand Up @@ -128,7 +127,7 @@ def shuffle(self, seed: int | None = None) -> None:
def sort(
self,
reverse: bool = False,
key: Optional[Callable[[Sample], "SupportsRichComparison"]] = sample_input_len,
key: Callable[[Sample], "SupportsRichComparison"] = sample_input_len,
) -> None:
"""Sort the dataset (in place) in ascending order and return None.
Expand Down Expand Up @@ -278,7 +277,7 @@ def shuffle(self, seed: int | None = None) -> None:
def sort(
self,
reverse: bool = False,
key: Optional[Callable[[Sample], "SupportsRichComparison"]] = sample_input_len,
key: Callable[[Sample], "SupportsRichComparison"] = sample_input_len,
) -> None:
self.samples.sort(reverse=reverse, key=key)

Expand Down
2 changes: 1 addition & 1 deletion src/inspect_ai/model/_call_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ def tool_param(type_hint: Type[Any], input: Any) -> Any:
dataclass_data: dict[str, Any] = {}
fields = type_hint.__dataclass_fields__ # type: ignore
for name, field in fields.items():
dataclass_data[name] = tool_param(field.type, input.get(name))
dataclass_data[name] = tool_param(field.type, input.get(name)) # type: ignore
return type_hint(**dataclass_data)
elif issubclass(type_hint, BaseModel):
return type_hint(**input)
Expand Down
2 changes: 1 addition & 1 deletion src/inspect_ai/tool/_tool_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def parse_object(cls: Type[Any]) -> ToolParam:
if is_dataclass(cls):
fields = cls.__dataclass_fields__ # type: ignore
for name, field in fields.items():
properties[name] = parse_type(field.type)
properties[name] = parse_type(field.type) # type: ignore
if field.default == field.default_factory:
required.append(name)
elif isinstance(cls, type) and issubclass(cls, BaseModel):
Expand Down

0 comments on commit 57a6719

Please sign in to comment.