PySerials 0.0.0.dev6__py3-none-any.whl → 0.0.0.dev8__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.
- {PySerials-0.0.0.dev6.dist-info → PySerials-0.0.0.dev8.dist-info}/METADATA +6 -5
- {PySerials-0.0.0.dev6.dist-info → PySerials-0.0.0.dev8.dist-info}/RECORD +6 -6
- {PySerials-0.0.0.dev6.dist-info → PySerials-0.0.0.dev8.dist-info}/WHEEL +1 -1
- pyserials/exception/read.py +8 -7
- pyserials/exception/validate.py +6 -6
- {PySerials-0.0.0.dev6.dist-info → PySerials-0.0.0.dev8.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PySerials
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev8
|
|
4
4
|
Requires-Python: >=3.10
|
|
5
5
|
Requires-Dist: jsonschema <5,>=4.21.0
|
|
6
|
+
Requires-Dist: referencing >=0.35.1
|
|
7
|
+
Requires-Dist: jsonpath-ng <2,>=1.6.1
|
|
6
8
|
Requires-Dist: ruamel.yaml <0.18,>=0.17.32
|
|
7
9
|
Requires-Dist: ruamel.yaml.string <1,>=0.1.1
|
|
8
10
|
Requires-Dist: tomlkit <0.12,>=0.11.8
|
|
9
|
-
Requires-Dist:
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist:
|
|
12
|
-
Requires-Dist: jsonpath-ng <2,>=1.6.1
|
|
11
|
+
Requires-Dist: MDit ==0.0.0.dev5
|
|
12
|
+
Requires-Dist: ExceptionMan ==0.0.0.dev5
|
|
13
|
+
Requires-Dist: ProtocolMan ==0.0.0.dev2
|
|
13
14
|
|
|
@@ -8,10 +8,10 @@ pyserials/validate.py,sha256=Ocs0x0BAV9zwRCgg_J5BGU2kEZV6vVjfDBsR3M9Teus,3564
|
|
|
8
8
|
pyserials/write.py,sha256=pN8w78qVsKJjZd_jvPUcZjYp_RJkP7uQzpiXvPOv4lM,1776
|
|
9
9
|
pyserials/exception/__init__.py,sha256=ZhbggwJUMlTyBhifAivC8ZQxP1Na6lJAwzZs7_YjOSU,151
|
|
10
10
|
pyserials/exception/_base.py,sha256=Juns3cyAEV9bZ4_nYuefQnPOrXvpQTY_7peXnoCjlgI,765
|
|
11
|
-
pyserials/exception/read.py,sha256=
|
|
11
|
+
pyserials/exception/read.py,sha256=7yTqtT2V4xXthg7wzNMI0bYF9GMDc-AaEN8r2PhRkMw,9282
|
|
12
12
|
pyserials/exception/update.py,sha256=P0js2-iY2fgO_KLdqedgWE3TTS5Xz15cusZY_wuKIW4,4222
|
|
13
|
-
pyserials/exception/validate.py,sha256=
|
|
14
|
-
PySerials-0.0.0.
|
|
15
|
-
PySerials-0.0.0.
|
|
16
|
-
PySerials-0.0.0.
|
|
17
|
-
PySerials-0.0.0.
|
|
13
|
+
pyserials/exception/validate.py,sha256=fs4yMw5wSbRbINuTbjdj7HGo8PlE3-zir1JRveJkcPk,7461
|
|
14
|
+
PySerials-0.0.0.dev8.dist-info/METADATA,sha256=V99F7qfD9BhoyfJ5BPB_iZ7FyjxgohvKWkoEKn7XUcU,435
|
|
15
|
+
PySerials-0.0.0.dev8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
16
|
+
PySerials-0.0.0.dev8.dist-info/top_level.txt,sha256=SAks7WjSjdkv3i9Hvt4gY_P7VQbhhYJN5mf5dqx1aao,10
|
|
17
|
+
PySerials-0.0.0.dev8.dist-info/RECORD,,
|
pyserials/exception/read.py
CHANGED
|
@@ -35,12 +35,13 @@ class PySerialsReadException(_base.PySerialsException):
|
|
|
35
35
|
filepath: _Path | None = None,
|
|
36
36
|
):
|
|
37
37
|
intro = _mdit.inline_container(
|
|
38
|
-
"Failed to read
|
|
39
|
-
f"{data_type.upper()} data
|
|
40
|
-
"from input
|
|
38
|
+
"Failed to read",
|
|
39
|
+
f"{data_type.upper()} data" if data_type else "data",
|
|
40
|
+
"from input",
|
|
41
41
|
"string." if source_type == "string" else _mdit.inline_container(
|
|
42
42
|
"file at ", _mdit.element.code_span(filepath), "."
|
|
43
43
|
),
|
|
44
|
+
separator=" ",
|
|
44
45
|
)
|
|
45
46
|
report = _mdit.document(
|
|
46
47
|
heading="Data Read Error",
|
|
@@ -175,7 +176,7 @@ class PySerialsInvalidDataError(PySerialsReadException):
|
|
|
175
176
|
|
|
176
177
|
def _report_content(self) -> dict:
|
|
177
178
|
|
|
178
|
-
def
|
|
179
|
+
def make_table(problem, line, column, data_type):
|
|
179
180
|
items = [
|
|
180
181
|
_mdit.element.field_list_item(title=title, description=value) for title, value in [
|
|
181
182
|
["Description", problem],
|
|
@@ -188,16 +189,16 @@ class PySerialsInvalidDataError(PySerialsReadException):
|
|
|
188
189
|
|
|
189
190
|
content = {
|
|
190
191
|
"problem_details": _mdit.element.admonition(
|
|
192
|
+
make_table(self.problem, self.problem_line, self.problem_column, self.problem_data_type),
|
|
191
193
|
type="error",
|
|
192
194
|
title="Problem",
|
|
193
|
-
content=make_tabel(self.problem, self.problem_line, self.problem_column, self.problem_data_type)
|
|
194
195
|
)
|
|
195
196
|
}
|
|
196
197
|
if self.context:
|
|
197
198
|
content["context_details"] = _mdit.element.admonition(
|
|
199
|
+
make_table(self.context, self.context_line, self.context_column, self.context_data_type),
|
|
198
200
|
type="note",
|
|
199
201
|
title="Context",
|
|
200
|
-
content=make_tabel(self.context, self.context_line, self.context_column, self.context_data_type)
|
|
201
202
|
)
|
|
202
203
|
|
|
203
204
|
code_block_full = _mdit.element.code_block(
|
|
@@ -235,6 +236,6 @@ class PySerialsInvalidDataError(PySerialsReadException):
|
|
|
235
236
|
emphasize_lines=list({1, len(selected_lines)}),
|
|
236
237
|
)
|
|
237
238
|
content["data_short"] = (code_block_short, ("short", "console"))
|
|
238
|
-
container = _mdit.block_container(
|
|
239
|
+
container = _mdit.block_container(content)
|
|
239
240
|
doc = _mdit.document(heading="Error Details", body=container)
|
|
240
241
|
return {"details": doc}
|
pyserials/exception/validate.py
CHANGED
|
@@ -5,7 +5,7 @@ from typing import Any as _Any
|
|
|
5
5
|
|
|
6
6
|
import jsonschema as _jsonschema
|
|
7
7
|
import mdit as _mdit
|
|
8
|
-
from
|
|
8
|
+
from protocolman import Stringable
|
|
9
9
|
|
|
10
10
|
from pyserials import write as _write
|
|
11
11
|
from pyserials.exception import _base
|
|
@@ -26,7 +26,7 @@ class PySerialsValidateException(_base.PySerialsException):
|
|
|
26
26
|
|
|
27
27
|
def __init__(
|
|
28
28
|
self,
|
|
29
|
-
problem
|
|
29
|
+
problem,
|
|
30
30
|
data: dict | list | str | int | float | bool,
|
|
31
31
|
schema: dict,
|
|
32
32
|
validator: _Any,
|
|
@@ -88,7 +88,7 @@ class PySerialsJsonSchemaValidationError(PySerialsValidateException):
|
|
|
88
88
|
self.causes = causes
|
|
89
89
|
super().__init__(
|
|
90
90
|
problem=self._generate_problem_statement(),
|
|
91
|
-
section={idx: self._generate_error_report(error) for idx, error in enumerate(self.causes)},
|
|
91
|
+
section={str(idx): self._generate_error_report(error) for idx, error in enumerate(self.causes)},
|
|
92
92
|
data=data,
|
|
93
93
|
schema=schema,
|
|
94
94
|
validator=validator,
|
|
@@ -145,7 +145,7 @@ class PySerialsJsonSchemaValidationError(PySerialsValidateException):
|
|
|
145
145
|
if error.context:
|
|
146
146
|
context_paths = []
|
|
147
147
|
for idx, sub_error in enumerate(sorted(error.context, key=lambda x: len(x.context))):
|
|
148
|
-
section[idx] = self._generate_error_report(sub_error)
|
|
148
|
+
section[str(idx)] = self._generate_error_report(sub_error)
|
|
149
149
|
context_paths.append(_mdit.element.code_span(sub_error.json_path))
|
|
150
150
|
context_paths_joined = self._join_list(context_paths)
|
|
151
151
|
short_ver_fieldlist_items.insert(
|
|
@@ -163,7 +163,7 @@ class PySerialsJsonSchemaValidationError(PySerialsValidateException):
|
|
|
163
163
|
heading=_mdit.element.code_span(error.json_path),
|
|
164
164
|
body={
|
|
165
165
|
"short": (_mdit.element.field_list(short_ver_fieldlist_items), ("short", "console")),
|
|
166
|
-
"full": (_mdit.
|
|
166
|
+
"full": (_mdit.block_container(*full_ver_items), "full"),
|
|
167
167
|
},
|
|
168
168
|
section=section,
|
|
169
169
|
)
|
|
@@ -176,9 +176,9 @@ class PySerialsJsonSchemaValidationError(PySerialsValidateException):
|
|
|
176
176
|
language="yaml",
|
|
177
177
|
)
|
|
178
178
|
admo = _mdit.element.admonition(
|
|
179
|
+
code_block,
|
|
179
180
|
type=admo_type,
|
|
180
181
|
title=_mdit.inline_container(f"**{title}**: ", _mdit.element.code_span(title_details)),
|
|
181
|
-
content=code_block,
|
|
182
182
|
dropdown=True,
|
|
183
183
|
)
|
|
184
184
|
return admo
|
|
File without changes
|