From 811b9a33c4b51bdb0c6f4b1839e82529da672a74 Mon Sep 17 00:00:00 2001 From: AN Long Date: Wed, 29 May 2024 20:32:54 +0800 Subject: [PATCH] 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