Skip to content

Commit

Permalink
👹 Feed the hobgoblins (delint).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 23, 2024
1 parent 2838176 commit a1b5960
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions keyring/backends/SecretService.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def priority(cls) -> float:
"activatable through D-Bus"
)
except exceptions.SecretStorageException as e:
raise RuntimeError("Unable to initialize SecretService: %s" % e)
raise RuntimeError("Unable to initialize SecretService: %s" % e) from e
return 5

def get_preferred_collection(self):
Expand All @@ -60,7 +60,7 @@ def get_preferred_collection(self):
else:
collection = secretstorage.get_default_collection(bus)
except exceptions.SecretStorageException as e:
raise InitError("Failed to create the collection: %s." % e)
raise InitError("Failed to create the collection: %s." % e) from e
if collection.is_locked():
collection.unlock()
if collection.is_locked(): # User dismissed the prompt
Expand Down
4 changes: 2 additions & 2 deletions keyring/backends/kwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def priority(cls) -> float:
try:
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
except dbus.DBusException as exc:
raise RuntimeError(exc.get_dbus_message())
raise RuntimeError(exc.get_dbus_message()) from exc
if not (
bus.name_has_owner(cls.bus_name)
or cls.bus_name in bus.list_activatable_names()
Expand Down Expand Up @@ -96,7 +96,7 @@ def connected(self, service):
self.iface = dbus.Interface(remote_obj, 'org.kde.KWallet')
self.handle = self.iface.open(self.iface.networkWallet(), wId, self.appid)
except dbus.DBusException as e:
raise InitError('Failed to open keyring: %s.' % e)
raise InitError('Failed to open keyring: %s.' % e) from e

if self.handle < 0:
return False
Expand Down
10 changes: 5 additions & 5 deletions keyring/backends/macOS/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ def set_password(self, service, username, password):
try:
api.set_generic_password(self.keychain, service, username, password)
except api.KeychainDenied as e:
raise KeyringLocked(f"Can't store password on keychain: {e}")
raise KeyringLocked(f"Can't store password on keychain: {e}") from e
except api.Error as e:
raise PasswordSetError(f"Can't store password on keychain: {e}")
raise PasswordSetError(f"Can't store password on keychain: {e}") from e

@warn_keychain
def get_password(self, service, username):
Expand All @@ -62,9 +62,9 @@ def get_password(self, service, username):
except api.NotFound:
pass
except api.KeychainDenied as e:
raise KeyringLocked(f"Can't get password from keychain: {e}")
raise KeyringLocked(f"Can't get password from keychain: {e}") from e
except api.Error as e:
raise KeyringError(f"Can't get password from keychain: {e}")
raise KeyringError(f"Can't get password from keychain: {e}") from e

@warn_keychain
def delete_password(self, service, username):
Expand All @@ -74,7 +74,7 @@ def delete_password(self, service, username):
try:
return api.delete_generic_password(self.keychain, service, username)
except api.Error as e:
raise PasswordDeleteError(f"Can't delete password in keychain: {e}")
raise PasswordDeleteError(f"Can't delete password in keychain: {e}") from e

def with_keychain(self, keychain):
warnings.warn(
Expand Down

0 comments on commit a1b5960

Please sign in to comment.