agi-med-common 4.2.11__py3-none-any.whl → 4.2.12__py3-none-any.whl
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.
- agi_med_common/__init__.py +2 -2
- agi_med_common/utils.py +14 -2
- {agi_med_common-4.2.11.dist-info → agi_med_common-4.2.12.dist-info}/METADATA +1 -1
- {agi_med_common-4.2.11.dist-info → agi_med_common-4.2.12.dist-info}/RECORD +6 -6
- {agi_med_common-4.2.11.dist-info → agi_med_common-4.2.12.dist-info}/WHEEL +0 -0
- {agi_med_common-4.2.11.dist-info → agi_med_common-4.2.12.dist-info}/top_level.txt +0 -0
agi_med_common/__init__.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
__version__ = "4.2.
|
1
|
+
__version__ = "4.2.12"
|
2
2
|
|
3
3
|
from .logger import LogLevelEnum, logger_init, log_llm_error
|
4
4
|
from .models import (
|
@@ -15,7 +15,7 @@ from .models import (
|
|
15
15
|
from .models.widget import Widget
|
16
16
|
from .file_storage import FileStorage, ResourceId
|
17
17
|
from .models import DiagnosticsXMLTagEnum, MTRSXMLTagEnum, DoctorChoiceXMLTagEnum
|
18
|
-
from .utils import make_session_id, read_json, try_parse_json, try_parse_int
|
18
|
+
from .utils import make_session_id, read_json, try_parse_json, try_parse_int, pretty_line
|
19
19
|
from .validators import ExistingPath, ExistingFile, ExistingDir, StrNotEmpty, SecretStrNotEmpty, Prompt, Message
|
20
20
|
from .xml_parser import XMLParser
|
21
21
|
from .parallel_map import parallel_map
|
agi_med_common/utils.py
CHANGED
@@ -17,17 +17,29 @@ def read_json(path: Path | os.PathLike[str] | str) -> list | dict:
|
|
17
17
|
def try_parse_json(text: str | None) -> str | None:
|
18
18
|
if not text:
|
19
19
|
return None
|
20
|
-
if not text.startswith(
|
20
|
+
if not text.startswith("{"):
|
21
21
|
return None
|
22
|
-
if not text.endswith(
|
22
|
+
if not text.endswith("}"):
|
23
23
|
return None
|
24
24
|
try:
|
25
25
|
return json.loads(text)
|
26
26
|
except Exception:
|
27
27
|
return None
|
28
28
|
|
29
|
+
|
29
30
|
def try_parse_int(text: str) -> int | None:
|
30
31
|
try:
|
31
32
|
return int(text)
|
32
33
|
except ValueError:
|
33
34
|
return None
|
35
|
+
|
36
|
+
|
37
|
+
def pretty_line(text: str, cut_count: int = 100) -> str:
|
38
|
+
if len(text) > 100:
|
39
|
+
text_cut = text[:cut_count]
|
40
|
+
size = len(text)
|
41
|
+
text_pretty = f'{text_cut}..(total {size} characters)'
|
42
|
+
else:
|
43
|
+
text_pretty = text
|
44
|
+
text_pretty = text_pretty.replace('\n', '\\n')
|
45
|
+
return text_pretty
|
@@ -1,7 +1,7 @@
|
|
1
|
-
agi_med_common/__init__.py,sha256=
|
1
|
+
agi_med_common/__init__.py,sha256=7GZe14D48F8klVwUrPho7sj0WVGQYrKj4aGrjNhXjcU,722
|
2
2
|
agi_med_common/file_storage.py,sha256=yAP65qT0NbkaasFLhwnNzXOpd5vAetF3wP6Sbf_tbak,1766
|
3
3
|
agi_med_common/parallel_map.py,sha256=Qx6xe7DqlEUDpSucp5Hm8r9y9Iquwh9JvX7lOqHhnOw,921
|
4
|
-
agi_med_common/utils.py,sha256=
|
4
|
+
agi_med_common/utils.py,sha256=pG4ayRBBgYKfEBULV6gZgl7AbI_K7VfByoSsB1BCIEI,1044
|
5
5
|
agi_med_common/validators.py,sha256=vMoPN42XzC8re-zdjekk5_lNQYHuTiAWD56YLvj2Z2w,2824
|
6
6
|
agi_med_common/xml_parser.py,sha256=VvLIX_XCZao9i0qqpTVx8nx0vbFXSe8pEbdJdXnj97g,568
|
7
7
|
agi_med_common/logger/__init__.py,sha256=RW_0VZtbeJ4RsLqUXZUQWl5CtV9g840rU7qRlf5u49E,96
|
@@ -14,7 +14,7 @@ agi_med_common/models/enums.py,sha256=RxPPbkW1NcHAGO-gHuzwIvOjv0_ZBsr9b1aq_wk4WF
|
|
14
14
|
agi_med_common/models/widget.py,sha256=g7Bobyk_gANghGEhjDjvi4i-YRoHo5Bm1Pr4eF-zf0U,661
|
15
15
|
agi_med_common/models/base_config_models/__init__.py,sha256=KjS_bSCka8BOMsigwcIML-e6eNB2ouMU6gxlhRmzeuY,44
|
16
16
|
agi_med_common/models/base_config_models/gigachat_config.py,sha256=WNSCTO8Fjpxc1v2LRUHfKqo9aeMDpXltTHYBFgTD2N0,422
|
17
|
-
agi_med_common-4.2.
|
18
|
-
agi_med_common-4.2.
|
19
|
-
agi_med_common-4.2.
|
20
|
-
agi_med_common-4.2.
|
17
|
+
agi_med_common-4.2.12.dist-info/METADATA,sha256=OrORy6dyLhEKWcE75DzpjkcAJLRfaNLWJ8lmUZf35jk,547
|
18
|
+
agi_med_common-4.2.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
19
|
+
agi_med_common-4.2.12.dist-info/top_level.txt,sha256=26o565jF_7wYQj7-YJfTedtT9yDxDcf8RNikOYuPq78,15
|
20
|
+
agi_med_common-4.2.12.dist-info/RECORD,,
|
File without changes
|
File without changes
|