File tree 1 file changed +5
-3
lines changed
aws_lambda_powertools/middleware_factory
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
1
3
import functools
2
4
import inspect
3
5
import logging
4
6
import os
5
- from typing import Any , Callable , Optional
7
+ from typing import Any , Callable
6
8
7
9
from ..shared import constants
8
10
from ..shared .functions import resolve_truthy_env_var_choice
13
15
14
16
15
17
# Maintenance: we can't yet provide an accurate return type without ParamSpec etc. see #1066
16
- def lambda_handler_decorator (decorator : Optional [ Callable ] = None , trace_execution : Optional [ bool ] = None ) -> Callable :
18
+ def lambda_handler_decorator (decorator : Callable | None = None , trace_execution : bool | None = None ) -> Callable :
17
19
"""Decorator factory for decorating Lambda handlers.
18
20
19
21
You can use lambda_handler_decorator to create your own middlewares,
@@ -112,7 +114,7 @@ def lambda_handler(event, context):
112
114
)
113
115
114
116
@functools .wraps (decorator )
115
- def final_decorator (func : Optional [ Callable ] = None , ** kwargs : Any ):
117
+ def final_decorator (func : Callable | None = None , ** kwargs : Any ):
116
118
# If called with kwargs return new func with kwargs
117
119
if func is None :
118
120
return functools .partial (final_decorator , ** kwargs )
You can’t perform that action at this time.
0 commit comments