Skip to content

Commit 82e2156

Browse files
authored
chore: clean up and fix test vector handler static analysis checks (#263)
* chore: fix pylint-test configuration * chore: clean up linting issues in test vector handler
1 parent 351f71d commit 82e2156

File tree

16 files changed

+42
-27
lines changed

16 files changed

+42
-27
lines changed

test_vector_handlers/src/awses_test_vectors/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Static test vector handling logic for the AWS Encyrption SDK."""
1314
__version__ = "1.0.0"

test_vector_handlers/src/awses_test_vectors/commands/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""CLI commands."""

test_vector_handlers/src/awses_test_vectors/commands/full_message_decrypt.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
AWS Encryption SDK full message decrypt command.
15-
"""
13+
"""AWS Encryption SDK full message decrypt command."""
1614
import argparse
1715

1816
from awses_test_vectors.manifests.full_message.decrypt import MessageDecryptionManifest

test_vector_handlers/src/awses_test_vectors/commands/full_message_encrypt.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
AWS Encryption SDK full message encrypt command.
15-
"""
13+
"""AWS Encryption SDK full message encrypt command."""
1614
import argparse
1715

1816
from awses_test_vectors.manifests.full_message.encrypt import MessageEncryptionManifest

test_vector_handlers/src/awses_test_vectors/internal/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Internal implementation details.
14+
15+
.. warning::
16+
No guarantee is provided on the modules and APIs within this
17+
namespace staying consistent. Directly reference at your own risk.
18+
"""

test_vector_handlers/src/awses_test_vectors/internal/aws_kms.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
Helper utilities for interacting with AWS KMS.
15-
"""
13+
"""Helper utilities for interacting with AWS KMS."""
1614
try:
1715
from aws_encryption_sdk.identifiers import AlgorithmSuite
1816
except ImportError:

test_vector_handlers/src/awses_test_vectors/internal/defaults.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
Default values for use in AWS Encryption SDK test vector handlers.
15-
"""
13+
"""Default values for use in AWS Encryption SDK test vector handlers."""
1614

1715
ENCODING = "utf-8"

test_vector_handlers/src/awses_test_vectors/internal/mypy_types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
MyPy types for use in AWS Encryption SDK test vector handlers.
15-
"""
13+
"""MyPy types for use in AWS Encryption SDK test vector handlers."""
1614
# mypy types confuse pylint: disable=invalid-name
1715

1816
try: # Python 3.5.0 and 3.5.1 have incompatible typing modules

test_vector_handlers/src/awses_test_vectors/internal/util.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13-
"""
14-
Utility functions for use in AWS Encryption SDK test vector handlers.
15-
"""
13+
"""Utility functions for use in AWS Encryption SDK test vector handlers."""
1614
import os
1715
import struct
1816
from binascii import unhexlify
@@ -100,7 +98,7 @@ def membership_validator(allowed):
10098
def _validate_membership(instance, attribute, value):
10199
# type: (object, Attribute, Any) -> None
102100
# pylint: disable=unused-argument
103-
""""""
101+
"""Perform membership check."""
104102
if value not in allowed:
105103
raise ValueError(
106104
'Unknown "{name}" value "{actual}" not in {expected}'.format(
@@ -178,9 +176,9 @@ def algorithm_suite_from_string_id(string_id):
178176
return AlgorithmSuite.get_by_id(numeric_id)
179177

180178

181-
# TODO: I want to replace these functions with an extensible "URI Handler" class
182-
# that will abstract away any file handling. This will vastly simply extending
183-
# these handlers to work with files in some non-local location, such as S3.
179+
# I want to replace these functions with an extensible "URI Handler" class
180+
# that will abstract away any file handling. This will vastly simply extending
181+
# these handlers to work with files in some non-local location, such as S3.
184182
def file_writer(parent_dir):
185183
# type: (str) -> Callable[[str, bytes], str]
186184
"""Return a caller that will write the requested named data to a file and return
@@ -214,7 +212,7 @@ def _write_file(name, data):
214212

215213
def file_reader(parent_dir):
216214
# type: (str) -> Callable[[str], bytes]
217-
"""Returns a callable that accepts a URI identifying a file relative to ``parent_dir``
215+
"""Return a callable that accepts a URI identifying a file relative to ``parent_dir``
218216
and returns the binary contents of that file.
219217
220218
:param str parent_dir: Parent directory to use as the relative root for all URIs

test_vector_handlers/src/awses_test_vectors/manifests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
1111
# ANY KIND, either express or implied. See the License for the specific
1212
# language governing permissions and limitations under the License.
13+
"""Test vector manifest handlers."""

0 commit comments

Comments
 (0)