Skip to content

Commit

Permalink
Release version 0.0.0.dev45
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Nov 22, 2024
1 parent c2217a5 commit fe77578
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev44"
version = "0.0.0.dev45"
name = "PySerials"
dependencies = [
"jsonschema >= 4.21.0, < 5",
Expand All @@ -26,8 +26,8 @@ dependencies = [
"ruamel.yaml >= 0.17.32, < 0.18", # https://yaml.readthedocs.io/en/stable/
"ruamel.yaml.string >= 0.1.1, < 1",
"tomlkit >= 0.11.8, < 0.12", # https://tomlkit.readthedocs.io/en/stable/,
"MDit == 0.0.0.dev41",
"ExceptionMan == 0.0.0.dev41",
"MDit == 0.0.0.dev42",
"ExceptionMan == 0.0.0.dev42",
"ProtocolMan == 0.0.0.dev2",
]
requires-python = ">=3.10"
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ jsonpath-ng >= 1.6.1, < 2
ruamel.yaml >= 0.17.32, < 0.18
ruamel.yaml.string >= 0.1.1, < 1
tomlkit >= 0.11.8, < 0.12
MDit == 0.0.0.dev41
ExceptionMan == 0.0.0.dev41
MDit == 0.0.0.dev42
ExceptionMan == 0.0.0.dev42
ProtocolMan == 0.0.0.dev2
43 changes: 18 additions & 25 deletions src/pyserials/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,21 +335,7 @@ def raise_error(path_invalid: str, description_template: str):
template_end=self._marker_end_value,
)

# if not internal:
# self._path_history.append(current_path)
# loop = self._find_loop()
# if loop:
# loop_str = "\n".join([f"- {path.replace("'", "")}" for path in loop])
# raise _exception.update.PySerialsUpdateTemplatedDataError(
# description_template=f"Path {{path_invalid}} starts a loop: {loop_str}",
# path_invalid=loop[0],
# path=current_path,
# data=templ,
# data_full=self._data,
# data_source=self._source,
# template_start=self._marker_start_value,
# template_end=self._marker_end_value,
# )
self._check_endless_loop(templ, current_chain)

if isinstance(templ, str):
# Handle value blocks
Expand Down Expand Up @@ -438,16 +424,23 @@ def raise_error(path_invalid: str, description_template: str):
return new_dict
return templ

# def _find_loop(self):
# for pattern_length in range(1, len(self._path_history) // 2 + 1):
# # Slice the end of the list into two consecutive patterns
# pattern = self._path_history[-pattern_length:]
# previous_pattern = self._path_history[-2 * pattern_length:-pattern_length]
# # Check if the two patterns are the same
# if pattern == previous_pattern:
# pattern.insert(0, pattern[-1])
# return pattern
# return
def _check_endless_loop(self,templ, chain: list[str]):
last_idx = len(chain) -1
first_idx = chain.index(chain[-1])
if first_idx == last_idx:
return
loop = chain[first_idx - 1: -1]
loop_str = "\n".join([f"- {path.replace("'", "")}" for path in loop])
raise _exception.update.PySerialsUpdateTemplatedDataError(
description_template=f"Path {{path_invalid}} starts a loop:\n{loop_str}",
path_invalid=loop[0],
path=chain[-1],
data=templ,
data_full=self._data,
data_source=self._data,
template_start=self._marker_start_value,
template_end=self._marker_end_value,
)

def _get_value_regex_pattern(self, level: int = 0) -> _RegexPattern:
if level in self._pattern_value:
Expand Down

0 comments on commit fe77578

Please sign in to comment.