mmar-mapi 1.0.17__tar.gz → 1.0.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mmar-mapi might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mmar-mapi
3
- Version: 1.0.17
3
+ Version: 1.0.18
4
4
  Summary: Common pure/IO utilities for multi-modal architectures team
5
5
  Keywords:
6
6
  Author: Eugene Tagin
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "mmar-mapi"
3
3
  # dynamic version is not supported yet on uv_build
4
- version = "1.0.17"
4
+ version = "1.0.18"
5
5
  description = "Common pure/IO utilities for multi-modal architectures team"
6
6
  authors = [{name = "Eugene Tagin", email = "tagin@airi.net"}]
7
7
  license = "MIT"
@@ -18,6 +18,7 @@ from .models.widget import Widget
18
18
  from .utils import make_session_id, chunked
19
19
  from .xml_parser import XMLParser
20
20
  from .utils_import import load_main_objects
21
+ from .decorators_maybe_lru_cache import maybe_lru_cache
21
22
 
22
23
  __all__ = [
23
24
  "AIMessage",
@@ -47,4 +48,5 @@ __all__ = [
47
48
  "load_main_objects",
48
49
  "make_content",
49
50
  "make_session_id",
51
+ "maybe_lru_cache",
50
52
  ]
@@ -0,0 +1,14 @@
1
+ from collections.abc import Callable
2
+ from functools import lru_cache
3
+
4
+ from loguru import logger
5
+
6
+
7
+ def maybe_lru_cache(maxsize: int, func: Callable) -> tuple[str, Callable]:
8
+ if maxsize >= 0:
9
+ maxsize = maxsize or None
10
+ logger.info(f"Caching for {func.__name__}: enabled: maxsize={maxsize}")
11
+ func = lru_cache(maxsize=maxsize)(func)
12
+ else:
13
+ logger.info(f"Caching for {func.__name__}: disabled")
14
+ return func
File without changes
File without changes