Skip to content
Snippets Groups Projects

Automatically add accounts to a known list after performing the appropriate actions

Merged Jakub Ziebinski requested to merge jziebinski/known-accounts into develop
Compare and Show latest version
3 files
+ 23
7
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -27,15 +27,15 @@ class AccountManager:
self._watched_accounts = WatchedAccountContainer()
self._known_accounts = KnownAccountContainer()
if known_accounts:
self.known.add(*known_accounts)
if working_account is not None:
self.set_working_account(working_account)
if watched_accounts:
self.watched.add(*watched_accounts)
if known_accounts:
self.known.add(*known_accounts)
@property
def working(self) -> WorkingAccount:
"""
@@ -204,11 +204,14 @@ class AccountManager:
to_add = to_add[1:]
# raise AccountAlreadyExistsError if any of the accounts is already a working account
# add the account to the known list if it does not already exist there
for account in to_add:
if self.is_account_working(account):
raise AccountAlreadyExistsError(Account.ensure_account_name(account), "WorkingAccount")
self.known.add(*to_add)
if not self.is_account_known(account):
self.known.add(account)
self.watched.add(*to_add)
def remove_tracked_account(self, *to_remove: str | Account) -> None:
Loading