Skip to content

Commit

Permalink
Replace .format with f-strings. Rely on repr to quote values.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 23, 2024
1 parent a1b5960 commit df6ebfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion keyring/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def find_user_password(self, realm, authuri):
user = self.get_username(realm, authuri)
password = get_password(realm, user)
if password is None:
prompt = 'password for {user}@{realm} for ' '{authuri}: '.format(**vars())
prompt = f'password for {user}@{realm} for {authuri}: '
password = getpass.getpass(prompt)
set_password(realm, user, password)
return user, password
Expand Down
8 changes: 4 additions & 4 deletions tests/backends/test_kwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def check_set_get(self, service, username, password):
self.keyring = keyring = self.init_keyring()
ret_password = keyring.get_password(service, username)
assert ret_password == "", (
"Incorrect password for username: '{}' "
"on service: '{}'. '{}' != '{}'".format(service, username, ret_password, ""),
f"Incorrect password for username: {service!r} "
f"on service: {username!r}. {ret_password!r} != ''",
)
ret_password = keyring.get_password('Python', username + '@' + service)
assert ret_password is None, (
f"Not 'None' password returned for username: '{service}' "
f"on service: '{username}'. '{ret_password}' != '{None}'. Passwords from old "
f"Not 'None' password returned for username: {service!r} "
f"on service: {username!r}. {ret_password!r} is not None. Passwords from old "
"folder should be deleted during migration.",
)

Expand Down

0 comments on commit df6ebfc

Please sign in to comment.