Skip to content

Commit dbed9b4

Browse files
fixes
1 parent 4a24975 commit dbed9b4

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

test_vector_handlers/src/awses_test_vectors/manifests/mpl_keyring.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,18 @@
1616
"""
1717
import json
1818
import attr
19-
2019
# Ignore missing MPL for pylint, but the MPL is required for this example
2120
# noqa pylint: disable=import-error
21+
import _dafny
22+
import UTF8
23+
24+
# Ignore pylint not being able to read a module that requires the MPL
25+
# pylint: disable=no-name-in-module
26+
from awses_test_vectors.internal.mpl.keyvectors_provider import KeyVectorsProvider
27+
from awses_test_vectors.manifests.keys import KeysManifest # noqa: disable=F401
28+
from .master_key import KNOWN_TYPES as MASTER_KEY_KNOWN_TYPES
29+
30+
2231
from aws_cryptography_materialproviderstestvectorkeys.smithygenerated.\
2332
aws_cryptography_materialproviderstestvectorkeys.models import (
2433
GetKeyDescriptionInput,
@@ -30,21 +39,13 @@
3039
from aws_cryptographic_materialproviders.mpl.references import IKeyring
3140
from aws_cryptographic_materialproviders.mpl.models import CreateMultiKeyringInput
3241

33-
from .master_key import KNOWN_TYPES as MASTER_KEY_KNOWN_TYPES
3442
from awses_test_vectors.internal.util import membership_validator
3543

36-
KEYRING_ONLY_KNOWN_TYPES = ("aws-kms-hierarchy", )
37-
38-
import _dafny
39-
import UTF8
44+
from .master_key import MasterKeySpec
4045

41-
# Ignore pylint not being able to read a module that requires the MPL
42-
# pylint: disable=no-name-in-module
43-
from awses_test_vectors.internal.mpl.keyvectors_provider import KeyVectorsProvider
44-
from awses_test_vectors.manifests.keys import KeysManifest # noqa: disable=F401
4546

47+
KEYRING_ONLY_KNOWN_TYPES = ("aws-kms-hierarchy", )
4648

47-
from .master_key import MasterKeySpec
4849

4950

5051
@attr.s
@@ -61,7 +62,9 @@ class KeyringSpec(MasterKeySpec): # pylint: disable=too-many-instance-attribute
6162
:param str padding_hash: Wrapping key padding hash (required for raw master keys)
6263
"""
6364

64-
type_name = attr.ib(validator=membership_validator(set(MASTER_KEY_KNOWN_TYPES).union(set(KEYRING_ONLY_KNOWN_TYPES))))
65+
type_name = attr.ib(validator=membership_validator(
66+
set(MASTER_KEY_KNOWN_TYPES).union(set(KEYRING_ONLY_KNOWN_TYPES))
67+
))
6568

6669
@classmethod
6770
def from_scenario(cls, spec):
@@ -100,9 +103,8 @@ def keyring(self, keys_uri, mode):
100103
"key": self.key_name,
101104
"provider-id": self.provider_id,
102105
"encryption-algorithm": self.encryption_algorithm,
103-
# "keyDescription":
104-
105106
}
107+
106108
if self.padding_algorithm is not None and self.padding_algorithm != "":
107109
input_kwargs["padding-algorithm"] = self.padding_algorithm
108110
if self.padding_hash is not None:
@@ -182,7 +184,7 @@ def keyring(self, keys_uri, mode):
182184

183185
return keyring
184186

185-
187+
186188
def _kms_hierarchy_keyring_from_spec(self, keys):
187189
# type: (KeysManifest) -> AwsKmsHierarchyKeyring
188190
"""Build an AWS KMS hierarchy keyring using this specification.
@@ -194,7 +196,7 @@ def _kms_hierarchy_keyring_from_spec(self, keys):
194196
"""
195197
if not self.type_name == "aws-kms-hierarchy":
196198
raise TypeError("This is not an AWS KMS hierarchy key")
197-
199+
198200
return keyring_from_master_key_specs(keys, )
199201

200202

0 commit comments

Comments
 (0)