foamlib 0.7.1__tar.gz → 0.7.2__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.
- {foamlib-0.7.1 → foamlib-0.7.2}/PKG-INFO +1 -1
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/__init__.py +1 -1
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_parsing.py +14 -13
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib.egg-info/PKG-INFO +1 -1
- {foamlib-0.7.1 → foamlib-0.7.2}/LICENSE.txt +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/README.md +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/__init__.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_async.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_base.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_run.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_slurm.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_subprocess.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_sync.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_cases/_util.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/__init__.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_files.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_io.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_serialization.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_types.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/_files/_util.py +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib/py.typed +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib.egg-info/SOURCES.txt +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib.egg-info/dependency_links.txt +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib.egg-info/requires.txt +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/foamlib.egg-info/top_level.txt +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/pyproject.toml +0 -0
- {foamlib-0.7.1 → foamlib-0.7.2}/setup.cfg +0 -0
@@ -41,7 +41,9 @@ from ._types import DataEntry, Dimensioned, DimensionSet, File
|
|
41
41
|
|
42
42
|
|
43
43
|
def _list_of(entry: ParserElement) -> ParserElement:
|
44
|
-
return (
|
44
|
+
return Opt(
|
45
|
+
Literal("List") + Literal("<") + _IDENTIFIER + Literal(">")
|
46
|
+
).suppress() + (
|
45
47
|
(
|
46
48
|
counted_array(entry, common.integer + Literal("(").suppress())
|
47
49
|
+ Literal(")").suppress()
|
@@ -59,7 +61,7 @@ def _list_of(entry: ParserElement) -> ParserElement:
|
|
59
61
|
|
60
62
|
def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
|
61
63
|
float_pattern = r"[+-]?((\d+\.?\d*(e[+-]?\d+)?)|nan|inf(inity)?)"
|
62
|
-
ignore_pattern = rf"(
|
64
|
+
ignore_pattern = rf"(?:\s|{ignore.re.pattern})+"
|
63
65
|
|
64
66
|
if size == 1:
|
65
67
|
tensor_pattern = float_pattern
|
@@ -81,7 +83,7 @@ def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
|
|
81
83
|
|
82
84
|
list_ <<= Regex(
|
83
85
|
rf"\((?:{ignore_pattern})?(?:{tensor_pattern}{ignore_pattern}){{{length - 1}}}{tensor_pattern}(?:{ignore_pattern})?\)",
|
84
|
-
re.IGNORECASE,
|
86
|
+
flags=re.IGNORECASE,
|
85
87
|
)
|
86
88
|
|
87
89
|
count = common.integer.add_parse_action(count_parse_action)
|
@@ -89,19 +91,18 @@ def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
|
|
89
91
|
def list_parse_action(
|
90
92
|
tks: ParseResults,
|
91
93
|
) -> list[list[float]] | list[list[list[float]]]:
|
92
|
-
values =
|
93
|
-
|
94
|
-
|
94
|
+
values = [
|
95
|
+
float(v)
|
96
|
+
for v in re.sub(ignore.re, " ", tks[0])
|
97
|
+
.replace("(", " ")
|
98
|
+
.replace(")", " ")
|
99
|
+
.split()
|
100
|
+
]
|
95
101
|
|
96
102
|
if size == 1:
|
97
|
-
return [
|
103
|
+
return [values]
|
98
104
|
|
99
|
-
return [
|
100
|
-
[
|
101
|
-
[float(v) for v in values[i : i + size]]
|
102
|
-
for i in range(0, len(values), size)
|
103
|
-
]
|
104
|
-
]
|
105
|
+
return [[values[i : i + size] for i in range(0, len(values), size)]]
|
105
106
|
|
106
107
|
list_.add_parse_action(list_parse_action)
|
107
108
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|