Fix errors reported by mypy

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2025-10-13 12:45:51 +02:00
commit bfd0544ff8
13 changed files with 68 additions and 71 deletions

View file

@ -74,11 +74,12 @@ class Auth(abc.ABC): # export
@classmethod
def load(cls, conf: Config, tp: str='') -> Self:
if tp == '':
tp = conf.get('type')
if tp is None:
val = conf.get('type')
if val is None:
msg = f'No type specified in auth configuration'
conf.dump(ERR, msg)
raise Exception(msg)
tp = val
return load_object(f'jwutils.auth.{tp}.Auth', Auth, 'Auth', conf)
def __init__(self, conf: Config):
@ -112,7 +113,7 @@ class Auth(abc.ABC): # export
return self._user(name)
@abc.abstractmethod
def _users(self) -> list[User]:
def _users(self) -> dict[str, User]:
raise NotImplementedError
def _user_by_email(self, email: str) -> User:
@ -128,7 +129,7 @@ class Auth(abc.ABC): # export
return self._user_by_email(email)
@property
def users(self) -> list[User]:
def users(self) -> dict[str, User]:
return self._users()
@abc.abstractmethod