Skip to content

Commit

Permalink
chore(lint): get around a Pydantic 2.10.x type bug (#566)
Browse files Browse the repository at this point in the history
Both mypy and pyright complain that the "field.default_factory()" call has too
few arguments, even though its type is typing.Callable[[], Any]. It should be
fixed soon, and in the meantime we can ignore the spurious error.

Ref: pydantic/pydantic#10945
  • Loading branch information
tigarmo authored and mr-cal committed Feb 4, 2025
1 parent f073900 commit db98616
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion craft_application/services/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def get_raw(self, item: str) -> Any:
self._cache[item] = field.default
return field.default
if field.default_factory is not None:
default = field.default_factory()
# TODO: remove the type ignore after pydantic/pydantic#10945 is fixed
default = field.default_factory() # type: ignore[call-arg]
self._cache[item] = default
return default

Expand Down

0 comments on commit db98616

Please sign in to comment.