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] = {
"credential-file": lambda n, s, c:
CredentialFileAuthenticator(n, CredentialFileAuthSection(s)),
"keyring": lambda n, s, c:
KeyringAuthenticator(n, KeyringAuthSection(s)),
"simple": lambda n, s, c:
SimpleAuthenticator(n, SimpleAuthSection(s)),
"tfa": lambda n, s, c:
TfaAuthenticator(n),
"keyring": lambda n, s, c:
KeyringAuthenticator(n, KeyringAuthSection(s)),
}

View File

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

View File

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

View File

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

View File

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