From db98616b0edab4267200ce451b8559325240086b Mon Sep 17 00:00:00 2001 From: Tiago Nobrega Date: Mon, 25 Nov 2024 16:35:12 -0300 Subject: [PATCH] chore(lint): get around a Pydantic 2.10.x type bug (#566) 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: https://github.com/pydantic/pydantic/issues/10945 --- craft_application/services/config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/craft_application/services/config.py b/craft_application/services/config.py index 319f9fbf..6b8c4e48 100644 --- a/craft_application/services/config.py +++ b/craft_application/services/config.py @@ -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