|
4 | 4 | import functools
|
5 | 5 | import logging
|
6 | 6 | import os
|
7 |
| -from inspect import isclass |
8 | 7 | from typing import Any, Callable, Dict, Optional, Type, Union, cast
|
9 | 8 |
|
10 | 9 | from aws_lambda_powertools.middleware_factory import lambda_handler_decorator
|
@@ -108,8 +107,8 @@ def idempotent_function(
|
108 | 107 | output_serializer: Optional[Union[BaseIdempotencySerializer, Type[BaseIdempotencyModelSerializer]]]
|
109 | 108 | Serializer to transform the data to and from a dictionary.
|
110 | 109 | If not supplied, no serialization is done via the NoOpSerializer.
|
111 |
| - In case a serializer of type inheriting BaseIdempotencyModelSerializer] is given, |
112 |
| - the serializer is deduced from the function return type. |
| 110 | + In case a serializer of type inheriting BaseIdempotencyModelSerializer is given, |
| 111 | + the serializer is derived from the function return type. |
113 | 112 | Examples
|
114 | 113 | --------
|
115 | 114 | **Processes an order in an idempotent manner**
|
@@ -137,7 +136,8 @@ def process_order(customer_id: str, order: dict, **kwargs):
|
137 | 136 | output_serializer=output_serializer,
|
138 | 137 | ),
|
139 | 138 | )
|
140 |
| - if isclass(output_serializer) and issubclass(output_serializer, BaseIdempotencyModelSerializer): |
| 139 | + |
| 140 | + if issubclass(output_serializer, BaseIdempotencyModelSerializer): |
141 | 141 | # instantiate an instance of the serializer class
|
142 | 142 | output_serializer = output_serializer.instantiate(function.__annotations__.get("return", None))
|
143 | 143 |
|
|
0 commit comments