Skip to content

Commit

Permalink
🧎‍♀️ Genuflect to the types.
Browse files Browse the repository at this point in the history
Add redundant type declarations to accessor functions.
  • Loading branch information
jaraco committed Feb 27, 2021
1 parent db6896a commit ceeaa92
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions keyring/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import logging
import typing

from . import backend
from . import backend, credentials
from .util import platform_ as platform
from .backends import fail

Expand Down Expand Up @@ -51,22 +51,24 @@ def disable():
file.write('[backend]\ndefault-keyring=keyring.backends.null.Keyring')


def get_password(service_name, username):
def get_password(service_name: str, username: str) -> typing.Optional[str]:
"""Get password from the specified service."""
return get_keyring().get_password(service_name, username)


def set_password(service_name, username, password):
def set_password(service_name: str, username: str, password: str) -> None:
"""Set password for the user in the specified service."""
get_keyring().set_password(service_name, username, password)


def delete_password(service_name, username):
def delete_password(service_name: str, username: str) -> None:
"""Delete the password for the user in the specified service."""
get_keyring().delete_password(service_name, username)


def get_credential(service_name, username):
def get_credential(
service_name: str, username: typing.Optional[str]
) -> typing.Optional[credentials.Credential]:
"""Get a Credential for the specified service."""
return get_keyring().get_credential(service_name, username)

Expand Down

0 comments on commit ceeaa92

Please sign in to comment.