foamlib 0.4.1__tar.gz → 0.4.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.4.1 → foamlib-0.4.2}/PKG-INFO +1 -1
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/__init__.py +1 -1
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/_base.py +1 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/_files.py +3 -3
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/_parsing.py +9 -6
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib.egg-info/PKG-INFO +1 -1
- {foamlib-0.4.1 → foamlib-0.4.2}/LICENSE.txt +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/README.md +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_cases/__init__.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_cases/_async.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_cases/_base.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_cases/_sync.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_cases/_util.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/__init__.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/_io.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_files/_serialization.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/_util.py +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib/py.typed +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib.egg-info/SOURCES.txt +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib.egg-info/dependency_links.txt +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib.egg-info/requires.txt +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/foamlib.egg-info/top_level.txt +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/pyproject.toml +0 -0
- {foamlib-0.4.1 → foamlib-0.4.2}/setup.cfg +0 -0
@@ -97,9 +97,9 @@ class FoamFile(
|
|
97
97
|
assert isinstance(ret, dict)
|
98
98
|
v = ret[k]
|
99
99
|
assert isinstance(v, dict)
|
100
|
-
ret = v
|
100
|
+
ret = cast(FoamFileBase._File, v)
|
101
101
|
|
102
|
-
return ret
|
102
|
+
return cast(FoamFileBase._Dict, ret)
|
103
103
|
|
104
104
|
def create(self, *, exist_ok: bool = False, parents: bool = False) -> Self:
|
105
105
|
"""
|
@@ -356,7 +356,7 @@ class FoamFile(
|
|
356
356
|
def __fspath__(self) -> str:
|
357
357
|
return str(self.path)
|
358
358
|
|
359
|
-
def as_dict(self) -> FoamFileBase.
|
359
|
+
def as_dict(self) -> FoamFileBase._File:
|
360
360
|
"""Return a nested dict representation of the file."""
|
361
361
|
_, parsed = self._read()
|
362
362
|
d = parsed.as_dict()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import array
|
2
2
|
import sys
|
3
|
-
from typing import Tuple, Union
|
3
|
+
from typing import Tuple, Union, cast
|
4
4
|
|
5
5
|
if sys.version_info >= (3, 9):
|
6
6
|
from collections.abc import Iterator, Mapping, MutableMapping, Sequence
|
@@ -266,17 +266,20 @@ class Parsed(Mapping[Tuple[str, ...], Union[FoamFileBase.Data, EllipsisType]]):
|
|
266
266
|
|
267
267
|
return start, end
|
268
268
|
|
269
|
-
def as_dict(self) -> FoamFileBase.
|
270
|
-
ret: FoamFileBase.
|
269
|
+
def as_dict(self) -> FoamFileBase._File:
|
270
|
+
ret: FoamFileBase._File = {}
|
271
271
|
for keywords, (_, data, _) in self._parsed.items():
|
272
272
|
r = ret
|
273
273
|
for k in keywords[:-1]:
|
274
|
-
assert isinstance(r, dict)
|
275
274
|
v = r[k]
|
276
275
|
assert isinstance(v, dict)
|
277
|
-
r = v
|
276
|
+
r = cast(FoamFileBase._File, v)
|
278
277
|
|
279
278
|
assert isinstance(r, dict)
|
280
|
-
|
279
|
+
if keywords:
|
280
|
+
r[keywords[-1]] = {} if data is ... else data
|
281
|
+
else:
|
282
|
+
assert data is not ...
|
283
|
+
r[None] = data
|
281
284
|
|
282
285
|
return ret
|
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
|