Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 24, 2025
1 parent 122d916 commit 2880aee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 5 additions & 3 deletions exodus_gw/aws/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(
from_date: str,
env_obj: Environment | None = None,
deadline: datetime | None = None,
mirror_writes: bool = True
mirror_writes: bool = True,
):
self.env = env
self.settings = settings
Expand Down Expand Up @@ -214,8 +214,10 @@ def should_mirror_write(self, uri):
# We only want to mirror writes for release ver aliases. Recalculating
# the aliases completely is a bit inefficient, but I'd rather not
# duplicate any alias logic.
return self.mirror_writes and \
uri_alias(uri, self._aliases(["releasever_alias"]))[0] != uri
return (
self.mirror_writes
and uri_alias(uri, self._aliases(["releasever_alias"]))[0] != uri
)

def create_request(
self,
Expand Down
15 changes: 7 additions & 8 deletions tests/aws/test_dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"object_key": {
"S": "3f449eb3b942af58e9aca4c1cffdef89"
"c3f1552c20787ae8c966767a1fedd3a5"
"c3f1552c20787ae8c966767a1fedd3a5"
},
"from_date": {"S": "2023-10-04 03:52:02"},
"content_type": {"S": None},
Expand Down Expand Up @@ -175,8 +175,6 @@ def test_batch_write(
)




@pytest.mark.parametrize(
"mirror,expected_request",
[
Expand Down Expand Up @@ -235,7 +233,7 @@ def test_batch_write(
},
"object_key": {
"S": "3f449eb3b942af58e9aca4c1cffdef89"
"c3f1552c20787ae8c966767a1fedd3a5"
"c3f1552c20787ae8c966767a1fedd3a5"
},
"from_date": {"S": "2023-10-04 03:52:02"},
"content_type": {"S": None},
Expand Down Expand Up @@ -285,7 +283,7 @@ def test_batch_write(
"web_uri": {"S": "/some/path"},
"object_key": {
"S": "0bacfc5268f9994065dd858ece3359fd"
"7a99d82af5be84202b8e84c2a5b07ffa"
"7a99d82af5be84202b8e84c2a5b07ffa"
},
# Note these timestamps come from the canned values
# on fake_publish.items
Expand All @@ -300,7 +298,7 @@ def test_batch_write(
"web_uri": {"S": "/other/path"},
"object_key": {
"S": "e448a4330ff79a1b20069d436fae9480"
"6a0e2e3a6b309cd31421ef088c6439fb"
"6a0e2e3a6b309cd31421ef088c6439fb"
},
"from_date": {"S": "2023-10-04 03:52:01"},
"content_type": {"S": None},
Expand All @@ -315,7 +313,7 @@ def test_batch_write(
},
"object_key": {
"S": "3f449eb3b942af58e9aca4c1cffdef89"
"c3f1552c20787ae8c966767a1fedd3a5"
"c3f1552c20787ae8c966767a1fedd3a5"
},
"from_date": {"S": "2023-10-04 03:52:02"},
"content_type": {"S": None},
Expand All @@ -330,7 +328,7 @@ def test_batch_write(
},
"object_key": {
"S": "5891b5b522d5df086d0ff0b110fbd9d2"
"1bb4fc7163af34d08286a2e846f6be03"
"1bb4fc7163af34d08286a2e846f6be03"
},
"from_date": {"S": "2023-10-04 03:52:02"},
"content_type": {"S": None},
Expand Down Expand Up @@ -360,6 +358,7 @@ def test_batch_write_mirror(
RequestItems=expected_request
)


def test_batch_write_item_limit(mock_boto3_client, fake_publish, caplog):
items = fake_publish.items * 9
ddb = dynamodb.DynamoDB("test", Settings(), NOW_UTC)
Expand Down

0 comments on commit 2880aee

Please sign in to comment.