From ceeaa922c6ac492505aabdb2791b86899adfedbc Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 27 Feb 2021 11:52:05 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=8E=E2=80=8D=E2=99=80=EF=B8=8F=20Genuf?= =?UTF-8?q?lect=20to=20the=20types.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add redundant type declarations to accessor functions. --- keyring/core.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/keyring/core.py b/keyring/core.py index fe121516..b76b9602 100644 --- a/keyring/core.py +++ b/keyring/core.py @@ -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 @@ -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)