diff --git a/src/corelibs/json_handling/jmespath_helper.py b/src/corelibs/json_handling/jmespath_helper.py index 2bb9e47..951fd64 100644 --- a/src/corelibs/json_handling/jmespath_helper.py +++ b/src/corelibs/json_handling/jmespath_helper.py @@ -32,4 +32,6 @@ def jmespath_search(search_data: dict[Any, Any] | list[Any], search_params: str) raise ValueError(f"Type error for search_params: {excp}") from excp return search_result +# TODO: compile jmespath setup + # __END__ diff --git a/src/corelibs/logging_handling/log.py b/src/corelibs/logging_handling/log.py index bad6faa..9a80db9 100644 --- a/src/corelibs/logging_handling/log.py +++ b/src/corelibs/logging_handling/log.py @@ -229,7 +229,8 @@ class LogParent: if log_error: self.logger.log( LoggingLevel.ERROR.value, - f"<=EXCEPTION> {msg}", *args, extra=dict(extra) | {'console': True}, stacklevel=2 + f"<=EXCEPTION> {msg} [{extra['stack_trace']}]", + *args, extra=dict(extra) | {'console': True}, stacklevel=2 ) self.logger.log(LoggingLevel.EXCEPTION.value, msg, *args, exc_info=True, extra=extra, stacklevel=2) diff --git a/test-run/json_handling/jmespath_helper.py b/test-run/json_handling/jmespath_helper.py new file mode 100644 index 0000000..9238051 --- /dev/null +++ b/test-run/json_handling/jmespath_helper.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +""" +jmes path testing +""" + +from corelibs.debug_handling.dump_data import dump_data +from corelibs.json_handling.jmespath_helper import jmespath_search + + +def main() -> None: + """ + Comment + """ + __set = { + 'a': 'b', + 'foobar': [1, 2, 'a'], + 'bar': { + 'a': 1, + 'b': 'c' + }, + 'baz': [ + { + 'aa': 1, + 'ab': 'cc' + }, + { + 'ba': 2, + 'bb': 'dd' + }, + ], + 'foo': { + 'a': [1, 2, 3], + 'b': ['a', 'b', 'c'] + } + } + + __get = [ + 'a', + 'bar.a', + 'foo.a', + 'baz[].aa' + ] + for __jmespath in __get: + result = jmespath_search(__set, __jmespath) + print(f"GET {__jmespath}: {dump_data(result)}") + + +if __name__ == "__main__": + main() + +# __END__ diff --git a/uv.lock b/uv.lock index 8270179..51ee24c 100644 --- a/uv.lock +++ b/uv.lock @@ -44,7 +44,7 @@ wheels = [ [[package]] name = "corelibs" -version = "0.18.1" +version = "0.19.0" source = { editable = "." } dependencies = [ { name = "jmespath" },