Common: Add type hints to dicts in credentials.py

This commit is contained in:
Mike Salvatore 2022-07-15 10:43:03 -04:00
parent 63731b8334
commit e3b23993fa
1 changed files with 3 additions and 3 deletions

View File

@ -1,7 +1,7 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Mapping, MutableMapping, Sequence from typing import Any, Mapping, MutableMapping, Sequence, Type
from marshmallow import Schema, fields, post_load, pre_dump from marshmallow import Schema, fields, post_load, pre_dump
from marshmallow.exceptions import MarshmallowError from marshmallow.exceptions import MarshmallowError
@ -24,7 +24,7 @@ from .password import PasswordSchema
from .ssh_keypair import SSHKeypairSchema from .ssh_keypair import SSHKeypairSchema
from .username import UsernameSchema from .username import UsernameSchema
CREDENTIAL_COMPONENT_TYPE_TO_CLASS = { CREDENTIAL_COMPONENT_TYPE_TO_CLASS: Mapping[CredentialComponentType, Type[ICredentialComponent]] = {
CredentialComponentType.LM_HASH: LMHash, CredentialComponentType.LM_HASH: LMHash,
CredentialComponentType.NT_HASH: NTHash, CredentialComponentType.NT_HASH: NTHash,
CredentialComponentType.PASSWORD: Password, CredentialComponentType.PASSWORD: Password,
@ -32,7 +32,7 @@ CREDENTIAL_COMPONENT_TYPE_TO_CLASS = {
CredentialComponentType.USERNAME: Username, CredentialComponentType.USERNAME: Username,
} }
CREDENTIAL_COMPONENT_TYPE_TO_CLASS_SCHEMA = { CREDENTIAL_COMPONENT_TYPE_TO_CLASS_SCHEMA: Mapping[CredentialComponentType, Schema] = {
CredentialComponentType.LM_HASH: LMHashSchema(), CredentialComponentType.LM_HASH: LMHashSchema(),
CredentialComponentType.NT_HASH: NTHashSchema(), CredentialComponentType.NT_HASH: NTHashSchema(),
CredentialComponentType.PASSWORD: PasswordSchema(), CredentialComponentType.PASSWORD: PasswordSchema(),