Skip to content

Commit ffdb761

Browse files
author
Lucas McDonald
committed
m
1 parent 8779b31 commit ffdb761

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1205
-432752
lines changed

DynamoDbEncryption/runtimes/python/pyproject.toml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,38 @@ optional = true
5252

5353
[tool.poetry.group.linting.dependencies]
5454
ruff = "^0.11.5"
55-
pydocstyle = "^6.3.0"
5655
black = "^25.1.0"
5756

5857
[tool.ruff]
5958
exclude = [
60-
# Don't lint Dafny-generated code
59+
# Don't bother linting Dafny-generated code
6160
"internaldafny",
6261
# Don't re-lint Smithy-generated code
6362
"smithygenerated",
6463
]
6564
line-length=120
6665
indent-width=4
6766
target-version = "py311"
67+
select = [
68+
# pycodestyle: spacing, line length
69+
"E",
70+
# pyflakes: unused imports/variables
71+
"F",
72+
# isort: import sorting
73+
"I",
74+
# pydocstyle: docstring style
75+
"D",
76+
# pyupgrade: auto-upgrade syntax if possible
77+
"UP",
78+
]
6879

69-
[tool.pydocstyle]
70-
match-dir = "^(?!internal$|internaldafny$|smithygenerated$).*"
80+
[tool.ruff.per-file-ignores]
81+
# Don't consider internal classes as "public" for linting purposes
82+
"src/aws_dbesdk_dynamodb/internal/*.py" = ["D100", "D101", "D102"]
7183

7284
[tool.black]
73-
exclude = "/(internal|internaldafny|smithygenerated)(/|$)"
85+
# Don't bother linting Dafny-generated code; don't re-lint Smithy-generated code
86+
exclude = "/(internaldafny|smithygenerated)(/|$)"
7487

7588
[build-system]
7689
requires = ["poetry-core<2.0.0"]

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
# Initialize generated Dafny
5-
from .internaldafny.generated import module_
6-
75
# Initialize externs
86
from .internaldafny import extern
7+
from .internaldafny.generated import module_
98

109
"""
1110
boto3 uses Python's decimal library to deserialize numbers retrieved by resources
@@ -27,9 +26,10 @@
2726
2827
For DBESDK DynamoDB, change the DynamoDB context to treat "Rounded" as acceptable.
2928
"""
30-
import boto3.dynamodb.types
3129
from decimal import Rounded
3230

31+
import boto3.dynamodb.types
32+
3333
old_context = boto3.dynamodb.types.DYNAMODB_CONTEXT
3434
old_traps = old_context.__getattribute__("traps")
3535
# traps structure: {k (trap class) : v (True if trap should raise Exception; False otherwise)}

DynamoDbEncryption/runtimes/python/src/aws_dbesdk_dynamodb/encrypted/boto3_interface.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import abc
4-
from typing import Any, Dict
54
from abc import abstractmethod
5+
from typing import Any
6+
67

78
class EncryptedBotoInterface(abc.ABC):
89
"""Interface for encrypted boto3 interfaces."""
910

10-
def _copy_sdk_response_to_dbesdk_response(self, sdk_response: Dict[str, Any], dbesdk_response: Dict[str, Any]) -> Dict[str, Any]:
11+
def _copy_sdk_response_to_dbesdk_response(
12+
self, sdk_response: dict[str, Any], dbesdk_response: dict[str, Any]
13+
) -> dict[str, Any]:
1114
"""Copy any missing fields from the SDK response to the DBESDK response.
1215
1316
Args:
@@ -16,6 +19,7 @@ def _copy_sdk_response_to_dbesdk_response(self, sdk_response: Dict[str, Any], db
1619
1720
Returns:
1821
dict: The DBESDK response with any missing fields copied from SDK response
22+
1923
"""
2024
for sdk_response_key, sdk_response_value in sdk_response.items():
2125
if sdk_response_key not in dbesdk_response:
@@ -38,6 +42,7 @@ def __getattr__(self, name: str) -> Any:
3842
3943
Raises:
4044
AttributeError: If the attribute doesn't exist on the underlying client
45+
4146
"""
4247
client_attr = getattr(self, self._boto_client_attr_name)
4348
if hasattr(client_attr, name):

0 commit comments

Comments
 (0)