foamlib 0.3.10__py3-none-any.whl → 0.3.11__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.
- foamlib/__init__.py +1 -1
- foamlib/_cases.py +2 -2
- foamlib/_files/_parsing.py +20 -6
- foamlib/_files/_serialization.py +6 -4
- {foamlib-0.3.10.dist-info → foamlib-0.3.11.dist-info}/METADATA +2 -2
- foamlib-0.3.11.dist-info/RECORD +15 -0
- {foamlib-0.3.10.dist-info → foamlib-0.3.11.dist-info}/WHEEL +1 -1
- foamlib-0.3.10.dist-info/RECORD +0 -15
- {foamlib-0.3.10.dist-info → foamlib-0.3.11.dist-info}/LICENSE.txt +0 -0
- {foamlib-0.3.10.dist-info → foamlib-0.3.11.dist-info}/top_level.txt +0 -0
foamlib/__init__.py
CHANGED
foamlib/_cases.py
CHANGED
@@ -498,7 +498,7 @@ class AsyncFoamCase(FoamCaseBase):
|
|
498
498
|
else:
|
499
499
|
for p in self._clean_paths():
|
500
500
|
if p.is_dir():
|
501
|
-
await aioshutil.rmtree(p)
|
501
|
+
await aioshutil.rmtree(p) # type: ignore [call-arg]
|
502
502
|
else:
|
503
503
|
p.unlink()
|
504
504
|
|
@@ -599,7 +599,7 @@ class AsyncFoamCase(FoamCaseBase):
|
|
599
599
|
|
600
600
|
async def restore_0_dir(self) -> None:
|
601
601
|
"""Restore the 0 directory from the 0.orig directory."""
|
602
|
-
await aioshutil.rmtree(self.path / "0", ignore_errors=True)
|
602
|
+
await aioshutil.rmtree(self.path / "0", ignore_errors=True) # type: ignore [call-arg]
|
603
603
|
await aioshutil.copytree(self.path / "0.orig", self.path / "0")
|
604
604
|
|
605
605
|
async def copy(self, dest: Union[Path, str]) -> "AsyncFoamCase":
|
foamlib/_files/_parsing.py
CHANGED
@@ -54,11 +54,10 @@ def _list_of(entry: ParserElement) -> ParserElement:
|
|
54
54
|
)
|
55
55
|
|
56
56
|
|
57
|
-
def
|
57
|
+
def _keyword_entry_of(
|
58
58
|
keyword: ParserElement,
|
59
59
|
data_entries: ParserElement,
|
60
60
|
*,
|
61
|
-
len: Union[int, EllipsisType] = ...,
|
62
61
|
located: bool = False,
|
63
62
|
) -> ParserElement:
|
64
63
|
subdict = Forward()
|
@@ -73,7 +72,7 @@ def _dictionary_of(
|
|
73
72
|
|
74
73
|
subdict <<= Dict(Group(keyword_entry)[...], asdict=not located)
|
75
74
|
|
76
|
-
return
|
75
|
+
return keyword_entry
|
77
76
|
|
78
77
|
|
79
78
|
_binary_contents = Forward()
|
@@ -146,7 +145,7 @@ _FIELD = (
|
|
146
145
|
)
|
147
146
|
_TOKEN = QuotedString('"', unquote_results=False) | _IDENTIFIER
|
148
147
|
_DATA = Forward()
|
149
|
-
_KEYWORD_ENTRY =
|
148
|
+
_KEYWORD_ENTRY = Dict(Group(_keyword_entry_of(_TOKEN, _DATA)), asdict=True)
|
150
149
|
_DATA_ENTRY = Forward()
|
151
150
|
_LIST_ENTRY = _KEYWORD_ENTRY | _DATA_ENTRY
|
152
151
|
_LIST = _list_of(_LIST_ENTRY)
|
@@ -159,7 +158,19 @@ _DATA <<= _DATA_ENTRY[1, ...].set_parse_action(
|
|
159
158
|
)
|
160
159
|
|
161
160
|
_FILE = (
|
162
|
-
|
161
|
+
Dict(
|
162
|
+
Group(_keyword_entry_of(_TOKEN, Opt(_DATA, default=""), located=True))[...]
|
163
|
+
+ Opt(
|
164
|
+
Group(
|
165
|
+
Located(
|
166
|
+
_DATA_ENTRY[1, ...].set_parse_action(
|
167
|
+
lambda tks: ["", tuple(tks) if len(tks) > 1 else tks[0]]
|
168
|
+
)
|
169
|
+
)
|
170
|
+
)
|
171
|
+
)
|
172
|
+
+ Group(_keyword_entry_of(_TOKEN, Opt(_DATA, default=""), located=True))[...]
|
173
|
+
)
|
163
174
|
.ignore(c_style_comment)
|
164
175
|
.ignore(cpp_style_comment)
|
165
176
|
.ignore(Literal("#include") + ... + LineEnd()) # type: ignore [no-untyped-call]
|
@@ -203,8 +214,11 @@ class Parsed(Mapping[Tuple[str, ...], Union[FoamDict.Data, EllipsisType]]):
|
|
203
214
|
return ret
|
204
215
|
|
205
216
|
def __getitem__(
|
206
|
-
self, keywords: Tuple[str, ...]
|
217
|
+
self, keywords: Union[str, Tuple[str, ...]]
|
207
218
|
) -> Union[FoamDict.Data, EllipsisType]:
|
219
|
+
if isinstance(keywords, str):
|
220
|
+
keywords = (keywords,)
|
221
|
+
|
208
222
|
_, data, _ = self._parsed[keywords]
|
209
223
|
return data
|
210
224
|
|
foamlib/_files/_serialization.py
CHANGED
@@ -39,12 +39,14 @@ def dumpb(
|
|
39
39
|
entries = []
|
40
40
|
for k, v in data.items():
|
41
41
|
b = dumpb(v, kind=kind)
|
42
|
-
if
|
42
|
+
if not k:
|
43
|
+
entries.append(b)
|
44
|
+
elif isinstance(v, Mapping):
|
43
45
|
entries.append(dumpb(k) + b"\n" + b"{\n" + b + b"\n}")
|
44
|
-
elif b:
|
45
|
-
entries.append(dumpb(k) + b" " + b + b";")
|
46
|
-
else:
|
46
|
+
elif not b:
|
47
47
|
entries.append(dumpb(k) + b";")
|
48
|
+
else:
|
49
|
+
entries.append(dumpb(k) + b" " + b + b";")
|
48
50
|
|
49
51
|
return b"\n".join(entries)
|
50
52
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: foamlib
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.11
|
4
4
|
Summary: A Python interface for interacting with OpenFOAM
|
5
5
|
Author-email: "Gabriel S. Gerlero" <ggerlero@cimec.unl.edu.ar>
|
6
6
|
Project-URL: Homepage, https://github.com/gerlero/foamlib
|
@@ -41,7 +41,7 @@ Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
|
41
41
|
Provides-Extra: lint
|
42
42
|
Requires-Dist: ruff ; extra == 'lint'
|
43
43
|
Provides-Extra: numpy
|
44
|
-
Requires-Dist: numpy <
|
44
|
+
Requires-Dist: numpy <3,>=1 ; extra == 'numpy'
|
45
45
|
Provides-Extra: test
|
46
46
|
Requires-Dist: foamlib[numpy] ; extra == 'test'
|
47
47
|
Requires-Dist: pytest <9,>=7 ; extra == 'test'
|
@@ -0,0 +1,15 @@
|
|
1
|
+
foamlib/__init__.py,sha256=m4p7yGjpDi2csSsHt9gXaWEWSPqGqHJjCeawUBzmNUM,432
|
2
|
+
foamlib/_cases.py,sha256=LK2EvZTAOejzDU7t2Vgsn7WG9AEdFoQwv5ifjWbyP2Y,21471
|
3
|
+
foamlib/_util.py,sha256=vL03aAzpWdZyYIhe2WTxHiz9b4lnttVnRuzqUmZvXXk,3047
|
4
|
+
foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
foamlib/_files/__init__.py,sha256=vDkPj8u8bX_I_m2YfeKvXBgwg8D1ufyFCfHGHKN3JPQ,140
|
6
|
+
foamlib/_files/_base.py,sha256=YA5a-i5HZuA3JslCD6r-DwZzpSA8r42dqSXef286Ako,2050
|
7
|
+
foamlib/_files/_files.py,sha256=4rZb3HMJADmJBGmRpChiujJNX1UIxhgHI5YPEmEOWvE,10784
|
8
|
+
foamlib/_files/_io.py,sha256=pGYMoLI5Dz2Y90EB1CtklZiffpDTGuQbbbkyqRe0JAo,2115
|
9
|
+
foamlib/_files/_parsing.py,sha256=SW1c1adDTg3e65hhZv5ZFDX8j654E88FDn13zl8gJ8c,7694
|
10
|
+
foamlib/_files/_serialization.py,sha256=LCeaLWtNvkcs0dfowL7nViiByxw7U_fvgueVjFliipU,3462
|
11
|
+
foamlib-0.3.11.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
|
12
|
+
foamlib-0.3.11.dist-info/METADATA,sha256=qHXzHhl0N-Sf1igVKDTgMUpYhlqYiIl9FyGEOjnWsFM,5458
|
13
|
+
foamlib-0.3.11.dist-info/WHEEL,sha256=Wyh-_nZ0DJYolHNn1_hMa4lM7uDedD_RGVwbmTjyItk,91
|
14
|
+
foamlib-0.3.11.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
|
15
|
+
foamlib-0.3.11.dist-info/RECORD,,
|
foamlib-0.3.10.dist-info/RECORD
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
foamlib/__init__.py,sha256=OJLrmY7uGGxH91O7KRnS7BR1s254VtAqPYaVzI2CikA,432
|
2
|
-
foamlib/_cases.py,sha256=4b9CCDAuKi5Dp8DUksIbaMsp0Yi0xv5QeZLVAUrKRh8,21417
|
3
|
-
foamlib/_util.py,sha256=vL03aAzpWdZyYIhe2WTxHiz9b4lnttVnRuzqUmZvXXk,3047
|
4
|
-
foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
foamlib/_files/__init__.py,sha256=vDkPj8u8bX_I_m2YfeKvXBgwg8D1ufyFCfHGHKN3JPQ,140
|
6
|
-
foamlib/_files/_base.py,sha256=YA5a-i5HZuA3JslCD6r-DwZzpSA8r42dqSXef286Ako,2050
|
7
|
-
foamlib/_files/_files.py,sha256=4rZb3HMJADmJBGmRpChiujJNX1UIxhgHI5YPEmEOWvE,10784
|
8
|
-
foamlib/_files/_io.py,sha256=pGYMoLI5Dz2Y90EB1CtklZiffpDTGuQbbbkyqRe0JAo,2115
|
9
|
-
foamlib/_files/_parsing.py,sha256=sWUeF9xiM6AriQjljl3jEpvoFRMmaS1h3bT3b0oor3U,7279
|
10
|
-
foamlib/_files/_serialization.py,sha256=rmZW42Pyn1DIJbGMZqFG_lZ5DcLhPmfUgH24qsu2rIk,3400
|
11
|
-
foamlib-0.3.10.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
|
12
|
-
foamlib-0.3.10.dist-info/METADATA,sha256=tmwwFbw9VKAIMBeJ-W8nP6iEfKXFxIRYmW57yDVvyLc,5458
|
13
|
-
foamlib-0.3.10.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
14
|
-
foamlib-0.3.10.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
|
15
|
-
foamlib-0.3.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|