Clean up authenticator code formatting

This commit is contained in:
Joscha 2021-05-31 18:21:18 +02:00
parent 1ce32d2f18
commit 49ad1b6e46
5 changed files with 6 additions and 20 deletions

View File

@ -17,10 +17,10 @@ AuthConstructor = Callable[[
AUTHENTICATORS: Dict[str, AuthConstructor] = { AUTHENTICATORS: Dict[str, AuthConstructor] = {
"credential-file": lambda n, s, c: "credential-file": lambda n, s, c:
CredentialFileAuthenticator(n, CredentialFileAuthSection(s)), CredentialFileAuthenticator(n, CredentialFileAuthSection(s)),
"keyring": lambda n, s, c:
KeyringAuthenticator(n, KeyringAuthSection(s)),
"simple": lambda n, s, c: "simple": lambda n, s, c:
SimpleAuthenticator(n, SimpleAuthSection(s)), SimpleAuthenticator(n, SimpleAuthSection(s)),
"tfa": lambda n, s, c: "tfa": lambda n, s, c:
TfaAuthenticator(n), TfaAuthenticator(n),
"keyring": lambda n, s, c:
KeyringAuthenticator(n, KeyringAuthSection(s)),
} }

View File

@ -17,10 +17,7 @@ class AuthSection(Section):
class Authenticator(ABC): class Authenticator(ABC):
def __init__( def __init__(self, name: str) -> None:
self,
name: str
) -> None:
""" """
Initialize an authenticator from its name and its section in the config Initialize an authenticator from its name and its section in the config
file. file.

View File

@ -18,11 +18,7 @@ class KeyringAuthSection(AuthSection):
class KeyringAuthenticator(Authenticator): class KeyringAuthenticator(Authenticator):
def __init__( def __init__(self, name: str, section: KeyringAuthSection) -> None:
self,
name: str,
section: KeyringAuthSection,
) -> None:
super().__init__(name) super().__init__(name)
self._username = section.username() self._username = section.username()

View File

@ -14,11 +14,7 @@ class SimpleAuthSection(AuthSection):
class SimpleAuthenticator(Authenticator): class SimpleAuthenticator(Authenticator):
def __init__( def __init__(self, name: str, section: SimpleAuthSection) -> None:
self,
name: str,
section: SimpleAuthSection,
) -> None:
super().__init__(name) super().__init__(name)
self._username = section.username() self._username = section.username()

View File

@ -6,10 +6,7 @@ from .authenticator import Authenticator, AuthError
class TfaAuthenticator(Authenticator): class TfaAuthenticator(Authenticator):
def __init__( def __init__(self, name: str) -> None:
self,
name: str,
) -> None:
super().__init__(name) super().__init__(name)
async def username(self) -> str: async def username(self) -> str: