foamlib 0.6.6__py3-none-any.whl → 0.6.7__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/_async.py +3 -3
- foamlib/_files/_files.py +11 -11
- foamlib/_files/_parsing.py +21 -4
- {foamlib-0.6.6.dist-info → foamlib-0.6.7.dist-info}/METADATA +15 -6
- {foamlib-0.6.6.dist-info → foamlib-0.6.7.dist-info}/RECORD +9 -9
- {foamlib-0.6.6.dist-info → foamlib-0.6.7.dist-info}/WHEEL +1 -1
- {foamlib-0.6.6.dist-info → foamlib-0.6.7.dist-info}/LICENSE.txt +0 -0
- {foamlib-0.6.6.dist-info → foamlib-0.6.7.dist-info}/top_level.txt +0 -0
foamlib/__init__.py
CHANGED
foamlib/_cases/_async.py
CHANGED
@@ -101,7 +101,7 @@ class AsyncFoamCase(FoamCaseRunBase):
|
|
101
101
|
async def _rmtree(
|
102
102
|
path: Union["os.PathLike[str]", str], ignore_errors: bool = False
|
103
103
|
) -> None:
|
104
|
-
await aioshutil.rmtree(path, ignore_errors=ignore_errors)
|
104
|
+
await aioshutil.rmtree(path, ignore_errors=ignore_errors)
|
105
105
|
|
106
106
|
@staticmethod
|
107
107
|
async def _copytree(
|
@@ -188,7 +188,7 @@ class AsyncFoamCase(FoamCaseRunBase):
|
|
188
188
|
@asynccontextmanager
|
189
189
|
async def copy(
|
190
190
|
self, dst: Optional[Union["os.PathLike[str]", str]] = None
|
191
|
-
) ->
|
191
|
+
) -> AsyncGenerator[Self, None]:
|
192
192
|
"""
|
193
193
|
Make a copy of this case.
|
194
194
|
|
@@ -209,7 +209,7 @@ class AsyncFoamCase(FoamCaseRunBase):
|
|
209
209
|
@asynccontextmanager
|
210
210
|
async def clone(
|
211
211
|
self, dst: Optional[Union["os.PathLike[str]", str]] = None
|
212
|
-
) ->
|
212
|
+
) -> AsyncGenerator[Self, None]:
|
213
213
|
"""
|
214
214
|
Clone this case (make a clean copy).
|
215
215
|
|
foamlib/_files/_files.py
CHANGED
@@ -86,7 +86,7 @@ class FoamFile(
|
|
86
86
|
|
87
87
|
def as_dict(self) -> FoamFileBase._Dict:
|
88
88
|
"""Return a nested dict representation of the dictionary."""
|
89
|
-
ret = self._file.as_dict()
|
89
|
+
ret = self._file.as_dict(include_header=True)
|
90
90
|
|
91
91
|
for k in self._keywords:
|
92
92
|
assert isinstance(ret, dict)
|
@@ -294,15 +294,10 @@ class FoamFile(
|
|
294
294
|
|
295
295
|
def _iter(self, keywords: Tuple[str, ...] = ()) -> Iterator[Optional[str]]:
|
296
296
|
_, parsed = self._read()
|
297
|
-
|
298
|
-
yield from (
|
299
|
-
k[-1] if k else None
|
300
|
-
for k in parsed
|
301
|
-
if k != ("FoamFile",) and k[:-1] == keywords
|
302
|
-
)
|
297
|
+
yield from (k[-1] if k else None for k in parsed if k[:-1] == keywords)
|
303
298
|
|
304
299
|
def __iter__(self) -> Iterator[Optional[str]]:
|
305
|
-
|
300
|
+
yield from (k for k in self._iter() if k != "FoamFile")
|
306
301
|
|
307
302
|
def __contains__(self, keywords: object) -> bool:
|
308
303
|
if not keywords:
|
@@ -328,11 +323,16 @@ class FoamFile(
|
|
328
323
|
def __fspath__(self) -> str:
|
329
324
|
return str(self.path)
|
330
325
|
|
331
|
-
def as_dict(self) -> FoamFileBase._File:
|
332
|
-
"""
|
326
|
+
def as_dict(self, *, include_header: bool = False) -> FoamFileBase._File:
|
327
|
+
"""
|
328
|
+
Return a nested dict representation of the file.
|
329
|
+
|
330
|
+
:param include_header: Whether to include the "FoamFile" header in the output.
|
331
|
+
"""
|
333
332
|
_, parsed = self._read()
|
334
333
|
d = parsed.as_dict()
|
335
|
-
|
334
|
+
if not include_header:
|
335
|
+
d.pop("FoamFile", None)
|
336
336
|
return d
|
337
337
|
|
338
338
|
|
foamlib/_files/_parsing.py
CHANGED
@@ -95,18 +95,35 @@ def _unpack_binary_field(
|
|
95
95
|
return [all]
|
96
96
|
|
97
97
|
|
98
|
+
_IDENTCHARS = identchars + "$"
|
99
|
+
_IDENTBODYCHARS = (
|
100
|
+
printables.replace(";", "")
|
101
|
+
.replace("{", "")
|
102
|
+
.replace("}", "")
|
103
|
+
.replace("[", "")
|
104
|
+
.replace("]", "")
|
105
|
+
)
|
106
|
+
|
98
107
|
_SWITCH = (
|
99
|
-
Keyword("yes"
|
108
|
+
Keyword("yes", _IDENTBODYCHARS)
|
109
|
+
| Keyword("true", _IDENTBODYCHARS)
|
110
|
+
| Keyword("on", _IDENTBODYCHARS)
|
111
|
+
| Keyword("y", _IDENTBODYCHARS)
|
112
|
+
| Keyword("t", _IDENTBODYCHARS)
|
100
113
|
).set_parse_action(lambda: True) | (
|
101
|
-
Keyword("no"
|
114
|
+
Keyword("no", _IDENTBODYCHARS)
|
115
|
+
| Keyword("false", _IDENTBODYCHARS)
|
116
|
+
| Keyword("off", _IDENTBODYCHARS)
|
117
|
+
| Keyword("n", _IDENTBODYCHARS)
|
118
|
+
| Keyword("f", _IDENTBODYCHARS)
|
102
119
|
).set_parse_action(lambda: False)
|
103
120
|
_DIMENSIONS = (
|
104
121
|
Literal("[").suppress() + common.number[0, 7] + Literal("]").suppress()
|
105
122
|
).set_parse_action(lambda tks: FoamFileBase.DimensionSet(*tks))
|
106
123
|
_TENSOR = _list_of(common.number) | common.number
|
107
124
|
_IDENTIFIER = Combine(
|
108
|
-
Word(
|
109
|
-
+ Opt(Literal("(") + Word(
|
125
|
+
Word(_IDENTCHARS, _IDENTBODYCHARS, exclude_chars="()")
|
126
|
+
+ Opt(Literal("(") + Word(_IDENTBODYCHARS, exclude_chars="()") + Literal(")"))
|
110
127
|
)
|
111
128
|
_DIMENSIONED = (Opt(_IDENTIFIER) + _DIMENSIONS + _TENSOR).set_parse_action(
|
112
129
|
lambda tks: FoamFileBase.Dimensioned(*reversed(tks.as_list()))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: foamlib
|
3
|
-
Version: 0.6.
|
3
|
+
Version: 0.6.7
|
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
|
@@ -37,12 +37,13 @@ Requires-Dist: foamlib[typing] ; extra == 'dev'
|
|
37
37
|
Requires-Dist: foamlib[docs] ; extra == 'dev'
|
38
38
|
Provides-Extra: docs
|
39
39
|
Requires-Dist: foamlib[numpy] ; extra == 'docs'
|
40
|
-
Requires-Dist: sphinx <9,>=
|
40
|
+
Requires-Dist: sphinx <9,>=5 ; extra == 'docs'
|
41
41
|
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
42
42
|
Provides-Extra: lint
|
43
43
|
Requires-Dist: ruff ; extra == 'lint'
|
44
44
|
Provides-Extra: numpy
|
45
45
|
Requires-Dist: numpy <3,>=1 ; extra == 'numpy'
|
46
|
+
Requires-Dist: numpy <3,>=1.25.0 ; (python_version >= "3.10") and extra == 'numpy'
|
46
47
|
Provides-Extra: test
|
47
48
|
Requires-Dist: foamlib[numpy] ; extra == 'test'
|
48
49
|
Requires-Dist: pytest <9,>=7 ; extra == 'test'
|
@@ -59,7 +60,9 @@ Requires-Dist: mypy <2,>=1 ; extra == 'typing'
|
|
59
60
|
[](https://codecov.io/gh/gerlero/foamlib)
|
60
61
|
[](http://mypy-lang.org/)
|
61
62
|
[](https://github.com/astral-sh/ruff)
|
63
|
+
[](https://github.com/astral-sh/uv)
|
62
64
|
[](https://pypi.org/project/foamlib/)
|
65
|
+
[](https://anaconda.org/conda-forge/foamlib)
|
63
66
|
[](https://pypi.org/project/foamlib/)
|
64
67
|

|
65
68
|
[](https://hub.docker.com/r/microfluidica/foamlib/)
|
@@ -77,11 +80,17 @@ It offers the following classes:
|
|
77
80
|
|
78
81
|
### Install
|
79
82
|
|
80
|
-
|
83
|
+
* With [pip](https://pypi.org/project/pip/):
|
81
84
|
|
82
|
-
```bash
|
83
|
-
pip install foamlib
|
84
|
-
```
|
85
|
+
```bash
|
86
|
+
pip install foamlib
|
87
|
+
```
|
88
|
+
|
89
|
+
* With [conda](https://docs.conda.io/en/latest/):
|
90
|
+
|
91
|
+
```bash
|
92
|
+
conda install -c conda-forge foamlib
|
93
|
+
```
|
85
94
|
|
86
95
|
### Clone a case
|
87
96
|
|
@@ -1,7 +1,7 @@
|
|
1
|
-
foamlib/__init__.py,sha256=
|
1
|
+
foamlib/__init__.py,sha256=iaj4sni5OiXEQQ21hCOeo3akWqysdXWCuJSu-uQwRIY,486
|
2
2
|
foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
foamlib/_cases/__init__.py,sha256=wTUHcUgU1CBgpu0cUMtksQ5VKG6B8CFu9xc3dWwsQuo,358
|
4
|
-
foamlib/_cases/_async.py,sha256=
|
4
|
+
foamlib/_cases/_async.py,sha256=rkJkOvOPQBcIrIyj2Q98HFh0eZ5QHzClSqEt-wcyS0M,7734
|
5
5
|
foamlib/_cases/_base.py,sha256=4VWsu22VockyKgU_5tnSMeNrAkMgBKwZo2KGkV65rRQ,6739
|
6
6
|
foamlib/_cases/_run.py,sha256=SjA-Qux5NhnhcLz7qiph2DcGYpElAAl_PlTGk6kGeuU,13972
|
7
7
|
foamlib/_cases/_slurm.py,sha256=rhGSFJ-3g72TnAYlhECGfs7P7IkeaHL3ysjXfXLdCCc,2308
|
@@ -10,13 +10,13 @@ foamlib/_cases/_sync.py,sha256=5lVMGuesCC--1GX8CL82bXg2o0K7OsZoff2zSOEs5d0,5910
|
|
10
10
|
foamlib/_cases/_util.py,sha256=GNndpqw3Jg_S-Hxzl5vwRgD0czcTNb9NYHMhcfBoMBg,1493
|
11
11
|
foamlib/_files/__init__.py,sha256=-UqB9YTH6mrJfXCX00kPTAAY20XG64u1MGPw_1ewLVs,148
|
12
12
|
foamlib/_files/_base.py,sha256=zaFDjLE6jB7WtGWk8hfKusjLtlGu6CZV16AHJpRUibs,1929
|
13
|
-
foamlib/_files/_files.py,sha256=
|
13
|
+
foamlib/_files/_files.py,sha256=nQXQ-NbRDy0GETYi4e9RHsnbvLxxjSTnXVpRbTV8iXY,15748
|
14
14
|
foamlib/_files/_io.py,sha256=T8vTEmJDidL03qeX1PUJFND-_vaF0AuC_0lE_zxLz7Q,2447
|
15
|
-
foamlib/_files/_parsing.py,sha256=
|
15
|
+
foamlib/_files/_parsing.py,sha256=SvPAbNb_xJwOBRGii4oLOUvhj9OdJ8auMIzdx77AYwI,9394
|
16
16
|
foamlib/_files/_serialization.py,sha256=pb8_cIVgRhGS_ZV2p3x8p5_lK1SS6xzQHscAYYuOgFY,3407
|
17
17
|
foamlib/_files/_util.py,sha256=UMzXmTFgvbp46w6k3oEZJoYC98pFgEK6LN5uLOwrlCg,397
|
18
|
-
foamlib-0.6.
|
19
|
-
foamlib-0.6.
|
20
|
-
foamlib-0.6.
|
21
|
-
foamlib-0.6.
|
22
|
-
foamlib-0.6.
|
18
|
+
foamlib-0.6.7.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
|
19
|
+
foamlib-0.6.7.dist-info/METADATA,sha256=ZgNLLtXhkCRJtcrycPWZfCxoEd3CU_HDv1--_4C7p-o,7333
|
20
|
+
foamlib-0.6.7.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
|
21
|
+
foamlib-0.6.7.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
|
22
|
+
foamlib-0.6.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|