From 69c2123dff59ff3df8e2abe0da059a9e6b0db05b Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Fri, 2 Aug 2024 11:30:30 +0200 Subject: [PATCH] Minor typing fix. --- plomtask/db.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plomtask/db.py b/plomtask/db.py index dc61f1a..ee5f3b9 100644 --- a/plomtask/db.py +++ b/plomtask/db.py @@ -340,7 +340,8 @@ class BaseModel(Generic[BaseModelId]): def __getattribute__(self, name: str) -> Any: """Ensure fail if ._disappear() was called, except to check ._exists""" if name != '_exists' and not super().__getattribute__('_exists'): - raise HandledException('Object does not exist.') + msg = f'Object for attribute does not exist: {name}' + raise HandledException(msg) return super().__getattribute__(name) def _disappear(self) -> None: @@ -365,10 +366,11 @@ class BaseModel(Generic[BaseModelId]): cls.cache_ = {} @classmethod - def get_cache(cls: type[BaseModelInstance]) -> dict[Any, BaseModel[Any]]: + def get_cache(cls: type[BaseModelInstance] + ) -> dict[Any, BaseModelInstance]: """Get cache dictionary, create it if not yet existing.""" if not hasattr(cls, 'cache_'): - d: dict[Any, BaseModel[Any]] = {} + d: dict[Any, BaseModelInstance] = {} cls.cache_ = d return cls.cache_ -- 2.30.2