pyRegRep 9__tar.gz → 11__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.
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyRegRep
3
- Version: 9
3
+ Version: 11
4
4
  Summary: Your package description
5
5
  Author: Andrey Shapovalov
6
6
  Author-email: mt.andrey@gmail.com
7
7
  Requires-Python: >=3.10
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: lxml>=5.2.1
11
+ Requires-Dist: xmltodict>=0.13.0
10
12
  Dynamic: author-email
11
13
  Dynamic: license-file
12
14
 
@@ -44,11 +46,10 @@ pip install pyRegRep
44
46
 
45
47
  # З локального джерела (editable)
46
48
  pip install -e .
47
-
48
- # Залежності вручну
49
- pip install -r requirements.txt
50
49
  ```
51
50
 
51
+ Під час встановлення через `pip install pyRegRep` або `pip install -e .` runtime-залежності (`lxml`, `xmltodict`) встановлюються автоматично.
52
+
52
53
  ## Швидкий старт
53
54
 
54
55
  ### Парсування XML документу
@@ -290,4 +291,4 @@ MIT License — див. файл [LICENSE](LICENSE)
290
291
 
291
292
  ---
292
293
 
293
- **Версія:** 9 · **Оновлено:** 2026-03-11
294
+ **Версія:** 11 · **Оновлено:** 2026-03-11
@@ -32,11 +32,10 @@ pip install pyRegRep
32
32
 
33
33
  # З локального джерела (editable)
34
34
  pip install -e .
35
-
36
- # Залежності вручну
37
- pip install -r requirements.txt
38
35
  ```
39
36
 
37
+ Під час встановлення через `pip install pyRegRep` або `pip install -e .` runtime-залежності (`lxml`, `xmltodict`) встановлюються автоматично.
38
+
40
39
  ## Швидкий старт
41
40
 
42
41
  ### Парсування XML документу
@@ -278,4 +277,4 @@ MIT License — див. файл [LICENSE](LICENSE)
278
277
 
279
278
  ---
280
279
 
281
- **Версія:** 9 · **Оновлено:** 2026-03-11
280
+ **Версія:** 11 · **Оновлено:** 2026-03-11
@@ -1,12 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyRegRep
3
- Version: 9
3
+ Version: 11
4
4
  Summary: Your package description
5
5
  Author: Andrey Shapovalov
6
6
  Author-email: mt.andrey@gmail.com
7
7
  Requires-Python: >=3.10
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
+ Requires-Dist: lxml>=5.2.1
11
+ Requires-Dist: xmltodict>=0.13.0
10
12
  Dynamic: author-email
11
13
  Dynamic: license-file
12
14
 
@@ -44,11 +46,10 @@ pip install pyRegRep
44
46
 
45
47
  # З локального джерела (editable)
46
48
  pip install -e .
47
-
48
- # Залежності вручну
49
- pip install -r requirements.txt
50
49
  ```
51
50
 
51
+ Під час встановлення через `pip install pyRegRep` або `pip install -e .` runtime-залежності (`lxml`, `xmltodict`) встановлюються автоматично.
52
+
52
53
  ## Швидкий старт
53
54
 
54
55
  ### Парсування XML документу
@@ -290,4 +291,4 @@ MIT License — див. файл [LICENSE](LICENSE)
290
291
 
291
292
  ---
292
293
 
293
- **Версія:** 9 · **Оновлено:** 2026-03-11
294
+ **Версія:** 11 · **Оновлено:** 2026-03-11
@@ -5,6 +5,7 @@ setup.py
5
5
  pyRegRep.egg-info/PKG-INFO
6
6
  pyRegRep.egg-info/SOURCES.txt
7
7
  pyRegRep.egg-info/dependency_links.txt
8
+ pyRegRep.egg-info/requires.txt
8
9
  pyRegRep.egg-info/top_level.txt
9
10
  pyRegRep4/NS.py
10
11
  pyRegRep4/RIMElement.py
@@ -0,0 +1,2 @@
1
+ lxml>=5.2.1
2
+ xmltodict>=0.13.0
@@ -13,6 +13,7 @@ class NS:
13
13
  "rs": "urn:oasis:names:tc:ebxml-regrep:xsd:rs:4.0",
14
14
  "xsi": "http://www.w3.org/2001/XMLSchema-instance",
15
15
  "xsd": "http://www.w3.org/2001/XMLSchema",
16
+ "xml": "http://www.w3.org/XML/1998/namespace",
16
17
  }
17
18
 
18
19
  def __init__(self):
@@ -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"), attrib={"lang": item["lang"]}
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 слотів на базі типу.
@@ -73,12 +73,20 @@ class Parsing:
73
73
  # Витягування основних елементів
74
74
  try:
75
75
  self.query = self.doc.find(".//query:Query", namespaces=self._ns)
76
- self.exception = self.doc.find(".//rs:Exception", namespaces=self._ns)
77
- self.objects = self.doc.findall(".//rim:RegistryObject", namespaces=self._ns)
78
- except KeyError as e:
76
+ except Exception as e:
79
77
  _logger.warning(f"Namespace не знайдено: {e}")
80
78
  self.query = None
79
+
80
+ try:
81
+ self.exception = self.doc.find(".//rs:Exception", namespaces=self._ns)
82
+ except Exception as e:
83
+ _logger.warning(f"Namespace не знайдено: {e}")
81
84
  self.exception = None
85
+
86
+ try:
87
+ self.objects = self.doc.findall(".//rim:RegistryObject", namespaces=self._ns)
88
+ except Exception as e:
89
+ _logger.warning(f"Namespace не знайдено: {e}")
82
90
  self.objects = []
83
91
 
84
92
  # Кешований результат
@@ -31,6 +31,6 @@ __all__ = [
31
31
  "_InternationalStringValueType",
32
32
  ]
33
33
 
34
- __version__ = "9"
34
+ __version__ = "11"
35
35
  __author__ = "Andrey Shapovalov"
36
36
 
@@ -4,12 +4,15 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pyRegRep"
7
- version = "9"
7
+ version = "11"
8
8
  description = "Your package description"
9
9
  authors = [{ name="Andrey Shapovalov" }]
10
10
  readme = "README.md"
11
11
  requires-python = ">=3.10"
12
- dependencies = []
12
+ dependencies = [
13
+ "lxml>=5.2.1",
14
+ "xmltodict>=0.13.0",
15
+ ]
13
16
 
14
17
  [tool.pytest.ini_options]
15
18
  pythonpath = ["."]
@@ -2,12 +2,15 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="pyRegRep",
5
- version="9",
5
+ version="11",
6
6
  description="Бібліотека для роботи з реєстрами та репозитаріями в Україні",
7
7
  packages=find_packages(),
8
8
  license="MIT",
9
9
  author="Andrii Shapovalov",
10
10
  author_email="mt.andrey@gmail.com",
11
11
  include_package_data=True,
12
- install_requires=[],
12
+ install_requires=[
13
+ "lxml>=5.2.1",
14
+ "xmltodict>=0.13.0",
15
+ ],
13
16
  )
@@ -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
- # Verify lang attributes
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
- # Verify text
328
- texts = {child.text for child in value_el}
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