pyRegRep 9__tar.gz → 10__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.
- {pyregrep-9 → pyregrep-10}/PKG-INFO +2 -2
- {pyregrep-9 → pyregrep-10}/README.md +1 -1
- {pyregrep-9 → pyregrep-10}/pyRegRep.egg-info/PKG-INFO +2 -2
- {pyregrep-9 → pyregrep-10}/pyRegRep4/NS.py +1 -0
- {pyregrep-9 → pyregrep-10}/pyRegRep4/RIMElement.py +8 -3
- {pyregrep-9 → pyregrep-10}/pyRegRep4/__init__.py +1 -1
- {pyregrep-9 → pyregrep-10}/pyproject.toml +1 -1
- {pyregrep-9 → pyregrep-10}/setup.py +1 -1
- {pyregrep-9 → pyregrep-10}/tests/test_rim_element.py +10 -4
- {pyregrep-9 → pyregrep-10}/LICENSE +0 -0
- {pyregrep-9 → pyregrep-10}/pyRegRep.egg-info/SOURCES.txt +0 -0
- {pyregrep-9 → pyregrep-10}/pyRegRep.egg-info/dependency_links.txt +0 -0
- {pyregrep-9 → pyregrep-10}/pyRegRep.egg-info/top_level.txt +0 -0
- {pyregrep-9 → pyregrep-10}/pyRegRep4/RIMParsing.py +0 -0
- {pyregrep-9 → pyregrep-10}/setup.cfg +0 -0
- {pyregrep-9 → pyregrep-10}/tests/test_get_slot_simple.py +0 -0
- {pyregrep-9 → pyregrep-10}/tests/test_rim_parsing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyRegRep
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10
|
|
4
4
|
Summary: Your package description
|
|
5
5
|
Author: Andrey Shapovalov
|
|
6
6
|
Author-email: mt.andrey@gmail.com
|
|
@@ -290,4 +290,4 @@ MIT License — див. файл [LICENSE](LICENSE)
|
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
-
**Версія:**
|
|
293
|
+
**Версія:** 10 · **Оновлено:** 2026-03-11
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyRegRep
|
|
3
|
-
Version:
|
|
3
|
+
Version: 10
|
|
4
4
|
Summary: Your package description
|
|
5
5
|
Author: Andrey Shapovalov
|
|
6
6
|
Author-email: mt.andrey@gmail.com
|
|
@@ -290,4 +290,4 @@ MIT License — див. файл [LICENSE](LICENSE)
|
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
-
**Версія:**
|
|
293
|
+
**Версія:** 10 · **Оновлено:** 2026-03-11
|
|
@@ -27,7 +27,8 @@ class Xml(NS):
|
|
|
27
27
|
if self._element is not None:
|
|
28
28
|
self._create_element()
|
|
29
29
|
|
|
30
|
-
def _create_element(self):
|
|
30
|
+
def _create_element(self):
|
|
31
|
+
...
|
|
31
32
|
|
|
32
33
|
@property
|
|
33
34
|
def element(self) -> etree._Element:
|
|
@@ -151,14 +152,18 @@ class _InternationalStringValueType(Xml):
|
|
|
151
152
|
def _intenation_element(self, item: dict) -> etree._Element | None:
|
|
152
153
|
if "lang" in item and "text" in item:
|
|
153
154
|
element = etree.Element(
|
|
154
|
-
self._tname("rim", "LocalizedString"),
|
|
155
|
+
self._tname("rim", "LocalizedString"),
|
|
156
|
+
attrib={
|
|
157
|
+
self._tname("xml", "lang"): item["lang"],
|
|
158
|
+
"value": item["text"]
|
|
159
|
+
}
|
|
155
160
|
)
|
|
156
|
-
element.text = item["text"]
|
|
157
161
|
return element
|
|
158
162
|
else:
|
|
159
163
|
_logger.warning(f"Invalid item format for InternationalStringValueType: {item}")
|
|
160
164
|
return None
|
|
161
165
|
|
|
166
|
+
|
|
162
167
|
def get_slot(name: str, slot_type: str, value: Any) -> Xml:
|
|
163
168
|
"""
|
|
164
169
|
Фабрична функція для створення RIM слотів на базі типу.
|
|
@@ -310,6 +310,7 @@ class TestInternationalStringValueType:
|
|
|
310
310
|
|
|
311
311
|
def test_list_of_dicts(self):
|
|
312
312
|
"""List of dicts with 'lang'/'text' keys creates LocalizedString elements."""
|
|
313
|
+
XML_NS = "http://www.w3.org/XML/1998/namespace"
|
|
313
314
|
data = [
|
|
314
315
|
{"lang": "en", "text": "Hello"},
|
|
315
316
|
{"lang": "uk", "text": "Привіт"},
|
|
@@ -321,11 +322,11 @@ class TestInternationalStringValueType:
|
|
|
321
322
|
value_el = slot.element.find(".//{*}SlotValue/{*}Value")
|
|
322
323
|
assert value_el is not None
|
|
323
324
|
assert len(value_el) == 2
|
|
324
|
-
#
|
|
325
|
-
langs = {child.attrib.get("lang") for child in value_el}
|
|
325
|
+
# lang is stored as {http://www.w3.org/XML/1998/namespace}lang attribute
|
|
326
|
+
langs = {child.attrib.get(f"{{{XML_NS}}}lang") for child in value_el}
|
|
326
327
|
assert langs == {"en", "uk"}
|
|
327
|
-
#
|
|
328
|
-
texts = {child.
|
|
328
|
+
# text is stored in "value" attribute (not .text)
|
|
329
|
+
texts = {child.attrib.get("value") for child in value_el}
|
|
329
330
|
assert "Hello" in texts
|
|
330
331
|
assert "Привіт" in texts
|
|
331
332
|
|
|
@@ -351,6 +352,7 @@ class TestInternationalStringValueType:
|
|
|
351
352
|
|
|
352
353
|
def test_list_mixed_elements_and_dicts(self):
|
|
353
354
|
"""List may contain both etree._Element and dict items."""
|
|
355
|
+
XML_NS = "http://www.w3.org/XML/1998/namespace"
|
|
354
356
|
e = etree.Element("LocalizedString")
|
|
355
357
|
e.attrib["lang"] = "en"
|
|
356
358
|
e.text = "From element"
|
|
@@ -362,6 +364,10 @@ class TestInternationalStringValueType:
|
|
|
362
364
|
|
|
363
365
|
value_el = slot.element.find(".//{*}SlotValue/{*}Value")
|
|
364
366
|
assert len(value_el) == 2
|
|
367
|
+
# dict item stores lang as xml:lang attribute
|
|
368
|
+
dict_child = value_el[1]
|
|
369
|
+
assert dict_child.attrib.get(f"{{{XML_NS}}}lang") == "uk"
|
|
370
|
+
assert dict_child.attrib.get("value") == "Від словника"
|
|
365
371
|
|
|
366
372
|
def test_list_with_unsupported_type_skipped(self, caplog):
|
|
367
373
|
"""Non-Element, non-dict items in list are skipped with a warning."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|