1
+ from __future__ import annotations
2
+
1
3
import base64
2
4
import gzip
3
5
import json
4
6
import logging
5
7
import warnings
6
- from typing import Any , Dict , Optional , Union
8
+ from typing import Any
7
9
8
10
import jmespath
9
11
from jmespath .exceptions import LexerError
@@ -33,7 +35,7 @@ def _func_powertools_base64_gzip(self, value):
33
35
return uncompressed .decode ()
34
36
35
37
36
- def query (data : Union [ Dict , str ] , envelope : str , jmespath_options : Optional [ Dict ] = None ) -> Any :
38
+ def query (data : dict | str , envelope : str , jmespath_options : dict | None = None ) -> Any :
37
39
"""Searches and extracts data using JMESPath
38
40
39
41
Envelope being the JMESPath expression to extract the data you're after
@@ -57,11 +59,11 @@ def handler(event: dict, context: LambdaContext):
57
59
58
60
Parameters
59
61
----------
60
- data : Dict
62
+ data : dict | str
61
63
Data set to be filtered
62
64
envelope : str
63
65
JMESPath expression to filter data against
64
- jmespath_options : Dict
66
+ jmespath_options : dict | None
65
67
Alternative JMESPath options to be included when filtering expr
66
68
67
69
@@ -82,7 +84,7 @@ def handler(event: dict, context: LambdaContext):
82
84
83
85
84
86
@deprecated ("`extract_data_from_envelope` is deprecated; use `query` instead." , category = None )
85
- def extract_data_from_envelope (data : Union [ Dict , str ] , envelope : str , jmespath_options : Optional [ Dict ] = None ) -> Any :
87
+ def extract_data_from_envelope (data : dict | str , envelope : str , jmespath_options : dict | None = None ) -> Any :
86
88
"""Searches and extracts data using JMESPath
87
89
88
90
*Deprecated*: Use query instead
0 commit comments