From 811b9a33c4b51bdb0c6f4b1839e82529da672a74 Mon Sep 17 00:00:00 2001 From: AN Long Date: Wed, 29 May 2024 20:32:54 +0800 Subject: [PATCH 1/2] fix a type mismatch for TransactionCanceled --- src/aiodynamo/errors.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aiodynamo/errors.py b/src/aiodynamo/errors.py index 60eb43d..e44f203 100644 --- a/src/aiodynamo/errors.py +++ b/src/aiodynamo/errors.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from typing import Any, Dict, List, Union +from typing import Any, Dict, Optional, List @dataclass(frozen=True) @@ -117,11 +117,11 @@ class PointInTimeRecoveryUnavailable(AIODynamoError): class TransactionCanceled(AIODynamoError): - cancellation_reasons: List[Union[CancellationReason, None]] + cancellation_reasons: List[Optional[CancellationReason]] def __init__(self, body: Dict[str, Any]): self.body = body - self.cancellation_reasons: List[CancellationReason] = [ + self.cancellation_reasons: List[Optional[CancellationReason]] = [ CancellationReason(reason["Code"], reason["Message"]) if reason["Code"] != "None" else None From 158fca79dbb49a8e592cfb3b5d8c10d98bc3a30e Mon Sep 17 00:00:00 2001 From: AN Long Date: Thu, 30 May 2024 20:32:33 +0800 Subject: [PATCH 2/2] make isort happy --- src/aiodynamo/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aiodynamo/errors.py b/src/aiodynamo/errors.py index e44f203..2688dff 100644 --- a/src/aiodynamo/errors.py +++ b/src/aiodynamo/errors.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from typing import Any, Dict, Optional, List +from typing import Any, Dict, List, Optional @dataclass(frozen=True)