PySerials 0.0.0.dev44__py3-none-any.whl → 0.0.0.dev46__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.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.1
2
+ Name: PySerials
3
+ Version: 0.0.0.dev46
4
+ Requires-Python: >=3.10
5
+ Requires-Dist: jsonschema<5,>=4.21.0
6
+ Requires-Dist: referencing>=0.35.1
7
+ Requires-Dist: jsonpath-ng<2,>=1.6.1
8
+ Requires-Dist: ruamel.yaml<0.18,>=0.17.32
9
+ Requires-Dist: ruamel.yaml.string<1,>=0.1.1
10
+ Requires-Dist: tomlkit<0.12,>=0.11.8
11
+ Requires-Dist: MDit==0.0.0.dev43
12
+ Requires-Dist: ExceptionMan==0.0.0.dev43
13
+ Requires-Dist: ProtocolMan==0.0.0.dev2
@@ -4,7 +4,7 @@ pyserials/format.py,sha256=dTukpab6WHSyVRQ9SteY5fhr3GFjWFboEl-1cw_udVY,1729
4
4
  pyserials/nested_dict.py,sha256=4LsdRWsRknmZv65UDbsyiNGYtG8rxh-F0EdXQNvpUOY,5257
5
5
  pyserials/property_dict.py,sha256=JqihWl3kDPZZqQHEkf5tN20EA5lJjy_37opSb-4u3ac,2257
6
6
  pyserials/read.py,sha256=uucYQH1V4GStwRgRZ2eQIXkH4ukB5qz0EA885grwi68,6592
7
- pyserials/update.py,sha256=tgkd7mywiYvm2tE_jPjuRWYsAoQ2Ap4NQ-OCI0ui9n0,21625
7
+ pyserials/update.py,sha256=vXYLYyIrGt0ss9nE6zPDU9fySJkz64vLreYqfkpKrZE,21177
8
8
  pyserials/validate.py,sha256=ti0D_yLzB_HELvf1d5qrarx1Ac-opBMN1Xh5lADRAQU,3664
9
9
  pyserials/write.py,sha256=pN8w78qVsKJjZd_jvPUcZjYp_RJkP7uQzpiXvPOv4lM,1776
10
10
  pyserials/exception/__init__.py,sha256=ZhbggwJUMlTyBhifAivC8ZQxP1Na6lJAwzZs7_YjOSU,151
@@ -12,7 +12,7 @@ pyserials/exception/_base.py,sha256=IdaZwBPBYgiUaWnvN0eMXvQQBqLbN1t766034CK7Hlc,
12
12
  pyserials/exception/read.py,sha256=QyG6ulExXH9u8oDRjUfter70SMDVQqL4nig5s-JzWN4,9252
13
13
  pyserials/exception/update.py,sha256=P0js2-iY2fgO_KLdqedgWE3TTS5Xz15cusZY_wuKIW4,4222
14
14
  pyserials/exception/validate.py,sha256=7UkQEEqCa8HJ20gpTFnLDhT3P5OPLD2oD9fUK2Jcuns,7466
15
- PySerials-0.0.0.dev44.dist-info/METADATA,sha256=xT04Th7i-SFw4ow4ljjYYnEPIrW5Vlx4YsZ6OzvP2YY,438
16
- PySerials-0.0.0.dev44.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
17
- PySerials-0.0.0.dev44.dist-info/top_level.txt,sha256=SAks7WjSjdkv3i9Hvt4gY_P7VQbhhYJN5mf5dqx1aao,10
18
- PySerials-0.0.0.dev44.dist-info/RECORD,,
15
+ PySerials-0.0.0.dev46.dist-info/METADATA,sha256=7zUshRz4OIIAQHHl8eZawzYjw89X7tOCCKjUc3h2Y8U,428
16
+ PySerials-0.0.0.dev46.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ PySerials-0.0.0.dev46.dist-info/top_level.txt,sha256=SAks7WjSjdkv3i9Hvt4gY_P7VQbhhYJN5mf5dqx1aao,10
18
+ PySerials-0.0.0.dev46.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.5.0)
2
+ Generator: setuptools (75.6.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
pyserials/update.py CHANGED
@@ -335,21 +335,7 @@ class TemplateFiller:
335
335
  template_end=self._marker_end_value,
336
336
  )
337
337
 
338
- # if not internal:
339
- # self._path_history.append(current_path)
340
- # loop = self._find_loop()
341
- # if loop:
342
- # loop_str = "\n".join([f"- {path.replace("'", "")}" for path in loop])
343
- # raise _exception.update.PySerialsUpdateTemplatedDataError(
344
- # description_template=f"Path {{path_invalid}} starts a loop: {loop_str}",
345
- # path_invalid=loop[0],
346
- # path=current_path,
347
- # data=templ,
348
- # data_full=self._data,
349
- # data_source=self._source,
350
- # template_start=self._marker_start_value,
351
- # template_end=self._marker_end_value,
352
- # )
338
+ self._check_endless_loop(templ, current_chain)
353
339
 
354
340
  if isinstance(templ, str):
355
341
  # Handle value blocks
@@ -438,16 +424,23 @@ class TemplateFiller:
438
424
  return new_dict
439
425
  return templ
440
426
 
441
- # def _find_loop(self):
442
- # for pattern_length in range(1, len(self._path_history) // 2 + 1):
443
- # # Slice the end of the list into two consecutive patterns
444
- # pattern = self._path_history[-pattern_length:]
445
- # previous_pattern = self._path_history[-2 * pattern_length:-pattern_length]
446
- # # Check if the two patterns are the same
447
- # if pattern == previous_pattern:
448
- # pattern.insert(0, pattern[-1])
449
- # return pattern
450
- # return
427
+ def _check_endless_loop(self,templ, chain: list[str]):
428
+ last_idx = len(chain) -1
429
+ first_idx = chain.index(chain[-1])
430
+ if first_idx == last_idx:
431
+ return
432
+ loop = chain[first_idx - 1: -1]
433
+ loop_str = "\n".join([f"- {path.replace("'", "")}" for path in loop])
434
+ raise _exception.update.PySerialsUpdateTemplatedDataError(
435
+ description_template=f"Path {{path_invalid}} starts a loop:\n{loop_str}",
436
+ path_invalid=loop[0],
437
+ path=chain[-1],
438
+ data=templ,
439
+ data_full=self._data,
440
+ data_source=self._data,
441
+ template_start=self._marker_start_value,
442
+ template_end=self._marker_end_value,
443
+ )
451
444
 
452
445
  def _get_value_regex_pattern(self, level: int = 0) -> _RegexPattern:
453
446
  if level in self._pattern_value:
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: PySerials
3
- Version: 0.0.0.dev44
4
- Requires-Python: >=3.10
5
- Requires-Dist: jsonschema <5,>=4.21.0
6
- Requires-Dist: referencing >=0.35.1
7
- Requires-Dist: jsonpath-ng <2,>=1.6.1
8
- Requires-Dist: ruamel.yaml <0.18,>=0.17.32
9
- Requires-Dist: ruamel.yaml.string <1,>=0.1.1
10
- Requires-Dist: tomlkit <0.12,>=0.11.8
11
- Requires-Dist: MDit ==0.0.0.dev41
12
- Requires-Dist: ExceptionMan ==0.0.0.dev41
13
- Requires-Dist: ProtocolMan ==0.0.0.dev2
14
-