Skip to content

Commit 2d4b2c4

Browse files
authored
Keyring reorg (aws#198)
* reorganize keyring tests to match aws#100 and keyring namespace to simplify names * change aws_encryption_sdk.keyring to aws_encryption_sdk.keyrings for consistency in namespace names * autoformat * disable pylint similarity checks on imports Because we provide multiple implementations of certain types of things (keyrings, etc), this was triggering pylint due to them all needing to import the same types in order to function. * remove aws_encryption_sdk namespace layer in test reorg
1 parent 998575c commit 2d4b2c4

File tree

19 files changed

+101
-41
lines changed

19 files changed

+101
-41
lines changed

src/aws_encryption_sdk/keyring/base.py renamed to src/aws_encryption_sdk/keyrings/base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
"""Base class interface for Keyrings."""
14-
from aws_encryption_sdk.materials_managers import ( # only used for mypy; pylint: disable=unused-import,duplicate-code
14+
from aws_encryption_sdk.materials_managers import ( # only used for mypy; pylint: disable=unused-import
1515
DecryptionMaterials,
1616
EncryptionMaterials,
1717
)
18-
from aws_encryption_sdk.structures import ( # only used for mypy; pylint: disable=unused-import,duplicate-code
19-
EncryptedDataKey,
20-
)
18+
from aws_encryption_sdk.structures import EncryptedDataKey # only used for mypy; pylint: disable=unused-import
2119

2220
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
2321
from typing import Iterable # noqa pylint: disable=unused-import

src/aws_encryption_sdk/keyring/multi_keyring.py renamed to src/aws_encryption_sdk/keyrings/multi.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@
1717
from attr.validators import deep_iterable, instance_of, optional
1818

1919
from aws_encryption_sdk.exceptions import EncryptKeyError, GenerateKeyError
20-
from aws_encryption_sdk.keyring.base import DecryptionMaterials # only used for mypy so pylint: disable=unused-import
21-
from aws_encryption_sdk.keyring.base import EncryptionMaterials # only used for mypy so pylint: disable=unused-import
22-
from aws_encryption_sdk.keyring.base import Keyring
23-
from aws_encryption_sdk.structures import EncryptedDataKey # only used for mypy so pylint: disable=unused-import
20+
from aws_encryption_sdk.keyrings.base import Keyring
21+
22+
from aws_encryption_sdk.materials_managers import ( # only used for mypy; pylint: disable=unused-import
23+
DecryptionMaterials,
24+
EncryptionMaterials,
25+
)
26+
from aws_encryption_sdk.structures import EncryptedDataKey # only used for mypy; pylint: disable=unused-import
2427

2528
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
2629
from typing import Iterable # noqa pylint: disable=unused-import

src/aws_encryption_sdk/keyring/raw_keyring.py renamed to src/aws_encryption_sdk/keyrings/raw.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
1313
"""Resources required for Raw Keyrings."""
14-
1514
import logging
1615
import os
1716

@@ -28,13 +27,18 @@
2827
from aws_encryption_sdk.internal.formatting.deserialize import deserialize_wrapped_key
2928
from aws_encryption_sdk.internal.formatting.serialize import serialize_raw_master_key_prefix, serialize_wrapped_key
3029
from aws_encryption_sdk.key_providers.raw import RawMasterKey
31-
from aws_encryption_sdk.keyring.base import Keyring
32-
from aws_encryption_sdk.materials_managers import ( # only used for mypy so pylint: disable=unused-import
30+
from aws_encryption_sdk.keyrings.base import Keyring
31+
from aws_encryption_sdk.structures import ( # pylint: disable=unused-import
32+
EncryptedDataKey,
33+
KeyringTrace,
34+
MasterKeyInfo,
35+
RawDataKey,
36+
)
37+
38+
from aws_encryption_sdk.materials_managers import ( # only used for mypy; pylint: disable=unused-import
3339
DecryptionMaterials,
3440
EncryptionMaterials,
3541
)
36-
from aws_encryption_sdk.structures import EncryptedDataKey # only used for mypy so pylint: disable=unused-import
37-
from aws_encryption_sdk.structures import KeyringTrace, MasterKeyInfo, RawDataKey
3842

3943
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules
4044
from typing import Iterable # noqa pylint: disable=unused-import

src/pylintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ additional-builtins = raw_input
3333
[DESIGN]
3434
max-args = 10
3535

36+
[SIMILARITIES]
37+
ignore-imports = yes
38+
3639
[FORMAT]
3740
max-line-length = 120
3841

test/__init__.py

Whitespace-only changes.

test/functional/keyrings/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License"). You
4+
# may not use this file except in compliance with the License. A copy of
5+
# the License is located at
6+
#
7+
# http://aws.amazon.com/apache2.0/
8+
#
9+
# or in the "license" file accompanying this file. This file is
10+
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11+
# ANY KIND, either express or implied. See the License for the specific
12+
# language governing permissions and limitations under the License.
13+
"""Dummy stub to make linters work better."""

test/functional/test_f_keyring_raw_aes.py renamed to test/functional/keyrings/raw/test_raw_aes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from aws_encryption_sdk.internal.crypto import WrappingKey
2525
from aws_encryption_sdk.internal.formatting.serialize import serialize_raw_master_key_prefix
2626
from aws_encryption_sdk.key_providers.raw import RawMasterKey
27-
from aws_encryption_sdk.keyring.raw_keyring import RawAESKeyring
27+
from aws_encryption_sdk.keyrings.raw import RawAESKeyring
2828
from aws_encryption_sdk.materials_managers import DecryptionMaterials, EncryptionMaterials
2929
from aws_encryption_sdk.structures import KeyringTrace, MasterKeyInfo, RawDataKey
3030

test/functional/test_f_keyring_raw_rsa.py renamed to test/functional/keyrings/raw/test_raw_rsa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
)
2727
from aws_encryption_sdk.internal.crypto import WrappingKey
2828
from aws_encryption_sdk.key_providers.raw import RawMasterKey
29-
from aws_encryption_sdk.keyring.raw_keyring import RawRSAKeyring
29+
from aws_encryption_sdk.keyrings.raw import RawRSAKeyring
3030
from aws_encryption_sdk.materials_managers import DecryptionMaterials, EncryptionMaterials
3131
from aws_encryption_sdk.structures import KeyringTrace, MasterKeyInfo, RawDataKey
3232

0 commit comments

Comments
 (0)