diff options
author | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-03-29 02:20:41 +0100 |
---|---|---|
committer | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-03-29 02:23:00 +0100 |
commit | 39230732099298b7f56c60b396949d8c0484e4dc (patch) | |
tree | d2fc00ccd36783183927fcb90b748641ed588e1d /accounts/backend/user/dummy.py | |
parent | dcad1d5ca832ea05ababa3d38de9a82fc361f2ba (diff) | |
download | web-39230732099298b7f56c60b396949d8c0484e4dc.tar.gz web-39230732099298b7f56c60b396949d8c0484e4dc.tar.bz2 web-39230732099298b7f56c60b396949d8c0484e4dc.zip |
Format project
To allow automatically formatting changes in the future.
Command used: black -l 79 accounts/
Diffstat (limited to 'accounts/backend/user/dummy.py')
-rw-r--r-- | accounts/backend/user/dummy.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/accounts/backend/user/dummy.py b/accounts/backend/user/dummy.py index fd6620a..cef1b7b 100644 --- a/accounts/backend/user/dummy.py +++ b/accounts/backend/user/dummy.py @@ -7,8 +7,9 @@ from accounts import AccountsFlask from typing import Optional -def _match_filter(account: Account, filters: Optional[dict[str, str]], - wildcard: bool): +def _match_filter( + account: Account, filters: Optional[dict[str, str]], wildcard: bool +): if filters is None: return True @@ -41,17 +42,17 @@ class DummyBackend(Backend): "test": { "uidNumber": 1, "mail": "test@accounts.spline.de", - "password": "test" + "password": "test", }, "test2": { "uidNumber": 2, "mail": "test2@accounts.spline.de", - "password": "test2" + "password": "test2", }, "admin": { "uidNumber": 3, "mail": "admin@accounts.spline.de", - "password": "admin" + "password": "admin", }, } @@ -61,11 +62,7 @@ class DummyBackend(Backend): accounts = [] for uid, attrs in self._storage.items(): accounts.append( - Account( - uid, - str(attrs["mail"]), - uidNumber=attrs["uidNumber"] - ) + Account(uid, str(attrs["mail"]), uidNumber=attrs["uidNumber"]) ) return accounts @@ -80,18 +77,23 @@ class DummyBackend(Backend): acc.password = password return acc - def find(self, filters: Optional[dict[str, str]] = None, - wildcard=False) -> list[Account]: + def find( + self, filters: Optional[dict[str, str]] = None, wildcard=False + ) -> list[Account]: """ Find accounts by a given filter. """ - return [acc for acc in self._get_accounts() if _match_filter(acc, filters, wildcard)] + return [ + acc + for acc in self._get_accounts() + if _match_filter(acc, filters, wildcard) + ] def _store(self, account: Account) -> None: self._storage[account.uid] = { "uidNumber": account.uidNumber, "mail": account.mail, - "password": account.password + "password": account.password, } def _verify_password(self, account: Account, password: Optional[str]): |