Skip to content

Commit 981769d

Browse files
author
Lucas McDonald
committed
wip lints
1 parent 354b806 commit 981769d

23 files changed

+643
-758
lines changed

Diff for: DynamoDbEncryption/runtimes/python/pyproject.toml

+27
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,33 @@ myst-parser = "^4"
4545
sphinx = "^7"
4646
sphinx_rtd_theme = "^2"
4747

48+
# Package linting
49+
50+
[tool.poetry.group.linting]
51+
optional = true
52+
53+
[tool.poetry.group.linting.dependencies]
54+
ruff = "^0.11.5"
55+
pydocstyle = "^6.3.0"
56+
black = "^25.1.0"
57+
58+
[tool.ruff]
59+
exclude = [
60+
# Don't lint Dafny-generated code
61+
"internaldafny",
62+
# Don't re-lint Smithy-generated code
63+
"smithygenerated",
64+
]
65+
line-length=120
66+
indent-width=4
67+
target-version = "py311"
68+
69+
[tool.pydocstyle]
70+
match-dir = "^(?!internal$|internaldafny$|smithygenerated$).*"
71+
72+
[tool.black]
73+
exclude = "/(internal|internaldafny|smithygenerated)(/|$)"
74+
4875
[build-system]
4976
requires = ["poetry-core<2.0.0"]
5077
build-backend = "poetry.core.masonry.api"

Diff for: DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/__init__.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
"""AWS Database Encryption SDK for DynamoDB."""
5+
46
# Initialize generated Dafny
5-
from .internaldafny.generated import module_
7+
from .internaldafny.generated import module_ # noqa: F401
68

79
# Initialize externs
8-
from .internaldafny import extern
10+
from .internaldafny import extern # noqa: F401
911

1012
"""
1113
boto3 uses Python's decimal library to deserialize numbers retrieved by resources
@@ -25,10 +27,10 @@
2527
Other DBESDK DynamoDB runtimes treat "Rounded" as acceptable, but "Inexact" as unacceptable.
2628
By default, boto3 will treat both "Rounded" and "Inexact" as unacceptable.
2729
28-
For DBESDK DynamoDB, change the DynamoDB context to treat "Rounded" as acceptable.
30+
When using DBESDK DynamoDB, change the DynamoDB context to treat "Rounded" as acceptable.
2931
"""
30-
import boto3.dynamodb.types
31-
from decimal import Rounded
32+
import boto3.dynamodb.types # noqa: E402
33+
from decimal import Rounded # noqa: E402
3234

3335
old_context = boto3.dynamodb.types.DYNAMODB_CONTEXT
3436
old_traps = old_context.__getattribute__("traps")

Diff for: DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/boto3_interface.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
3+
"""Interface for interacting with DynamoDB using boto3."""
34
import abc
45
from typing import Any, Dict
56
from abc import abstractmethod
67

8+
79
class EncryptedBotoInterface(abc.ABC):
810
"""Interface for encrypted boto3 interfaces."""
911

10-
def _copy_sdk_response_to_dbesdk_response(self, sdk_response: Dict[str, Any], dbesdk_response: Dict[str, Any]) -> Dict[str, Any]:
12+
def _copy_sdk_response_to_dbesdk_response(
13+
self, sdk_response: Dict[str, Any], dbesdk_response: Dict[str, Any]
14+
) -> Dict[str, Any]:
1115
"""Copy any missing fields from the SDK response to the DBESDK response.
1216
1317
Args:
14-
sdk_response: The raw SDK response
15-
dbesdk_response: The current DBESDK response
18+
sdk_response: The raw SDK response.
19+
dbesdk_response: The current DBESDK response.
1620
1721
Returns:
18-
dict: The DBESDK response with any missing fields copied from SDK response
22+
dict: The DBESDK response with any missing fields copied from SDK response.
1923
"""
2024
for sdk_response_key, sdk_response_value in sdk_response.items():
2125
if sdk_response_key not in dbesdk_response:
@@ -42,4 +46,6 @@ def __getattr__(self, name: str) -> Any:
4246
client_attr = getattr(self, self._boto_client_attr_name)
4347
if hasattr(client_attr, name):
4448
return getattr(client_attr, name)
45-
raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'")
49+
raise AttributeError(
50+
f"'{self.__class__.__name__}' object has no attribute '{name}'"
51+
)

0 commit comments

Comments
 (0)