1+ from __future__ import annotations
2+
13import base64
24import gzip
35import json
46import logging
57import warnings
6- from typing import Any , Dict , Optional , Union
8+ from typing import Any
79
810import jmespath
911from jmespath .exceptions import LexerError
@@ -33,7 +35,7 @@ def _func_powertools_base64_gzip(self, value):
3335 return uncompressed .decode ()
3436
3537
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 :
3739 """Searches and extracts data using JMESPath
3840
3941 Envelope being the JMESPath expression to extract the data you're after
@@ -57,11 +59,11 @@ def handler(event: dict, context: LambdaContext):
5759
5860 Parameters
5961 ----------
60- data : Dict
62+ data : dict | str
6163 Data set to be filtered
6264 envelope : str
6365 JMESPath expression to filter data against
64- jmespath_options : Dict
66+ jmespath_options : dict | None
6567 Alternative JMESPath options to be included when filtering expr
6668
6769
@@ -82,7 +84,7 @@ def handler(event: dict, context: LambdaContext):
8284
8385
8486@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 :
8688 """Searches and extracts data using JMESPath
8789
8890 *Deprecated*: Use query instead
0 commit comments