foamlib 0.3.18__py3-none-any.whl → 0.3.19__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/_files/_files.py +18 -18
- {foamlib-0.3.18.dist-info → foamlib-0.3.19.dist-info}/METADATA +1 -1
- {foamlib-0.3.18.dist-info → foamlib-0.3.19.dist-info}/RECORD +7 -7
- {foamlib-0.3.18.dist-info → foamlib-0.3.19.dist-info}/LICENSE.txt +0 -0
- {foamlib-0.3.18.dist-info → foamlib-0.3.19.dist-info}/WHEEL +0 -0
- {foamlib-0.3.18.dist-info → foamlib-0.3.19.dist-info}/top_level.txt +0 -0
foamlib/__init__.py
CHANGED
foamlib/_files/_files.py
CHANGED
@@ -149,7 +149,7 @@ class FoamFile(
|
|
149
149
|
return ret
|
150
150
|
|
151
151
|
@property
|
152
|
-
def header(self) ->
|
152
|
+
def header(self) -> Header:
|
153
153
|
"""Alias of `self["FoamFile"]`."""
|
154
154
|
ret = self["FoamFile"]
|
155
155
|
if not isinstance(ret, FoamFile.Header):
|
@@ -157,6 +157,10 @@ class FoamFile(
|
|
157
157
|
raise TypeError("FoamFile is not a dictionary")
|
158
158
|
return ret
|
159
159
|
|
160
|
+
@header.setter
|
161
|
+
def header(self, data: FoamDict._Dict) -> None:
|
162
|
+
self["FoamFile"] = data
|
163
|
+
|
160
164
|
def __getitem__(
|
161
165
|
self, keywords: Union[str, Tuple[str, ...]]
|
162
166
|
) -> Union["FoamFile.Data", "FoamFile.SubDict"]:
|
@@ -180,24 +184,30 @@ class FoamFile(
|
|
180
184
|
return self.get(("FoamFile", "format"), None) == "binary"
|
181
185
|
|
182
186
|
def __setitem__(
|
183
|
-
self,
|
184
|
-
keywords: Union[str, Tuple[str, ...]],
|
185
|
-
data: "FoamFile._SetData",
|
186
|
-
*,
|
187
|
-
assume_field: bool = False,
|
188
|
-
assume_dimensions: bool = False,
|
187
|
+
self, keywords: Union[str, Tuple[str, ...]], data: "FoamFile._SetData"
|
189
188
|
) -> None:
|
190
189
|
with self:
|
191
190
|
if not isinstance(keywords, tuple):
|
192
191
|
keywords = (keywords,)
|
193
192
|
|
193
|
+
if not self and keywords[0] != "FoamFile":
|
194
|
+
self.header = {
|
195
|
+
"version": 2.0,
|
196
|
+
"format": "ascii",
|
197
|
+
"class": "dictionary",
|
198
|
+
"location": f'"{self.path.parent.name}"',
|
199
|
+
"object": self.path.name,
|
200
|
+
} # type: ignore [assignment]
|
201
|
+
|
194
202
|
kind = Kind.DEFAULT
|
195
203
|
if keywords == ("internalField",) or (
|
196
204
|
len(keywords) == 3
|
197
205
|
and keywords[0] == "boundaryField"
|
198
206
|
and keywords[2] == "value"
|
199
207
|
):
|
200
|
-
kind =
|
208
|
+
kind = (
|
209
|
+
Kind.BINARY_FIELD if self.header.format == "binary" else Kind.FIELD
|
210
|
+
)
|
201
211
|
elif keywords == ("dimensions",):
|
202
212
|
kind = Kind.DIMENSIONS
|
203
213
|
|
@@ -220,16 +230,6 @@ class FoamFile(
|
|
220
230
|
for k, v in data.items():
|
221
231
|
self[(*keywords, k)] = v
|
222
232
|
|
223
|
-
elif not self and keywords[0] != "FoamFile":
|
224
|
-
self["FoamFile"] = {
|
225
|
-
"version": 2.0,
|
226
|
-
"format": "ascii",
|
227
|
-
"class": "dictionary",
|
228
|
-
"location": f'"{self.path.parent.name}"',
|
229
|
-
"object": self.path.name,
|
230
|
-
}
|
231
|
-
self[keywords] = data
|
232
|
-
|
233
233
|
elif (
|
234
234
|
kind == Kind.FIELD or kind == Kind.BINARY_FIELD
|
235
235
|
) and self.header.class_ == "dictionary":
|
@@ -1,4 +1,4 @@
|
|
1
|
-
foamlib/__init__.py,sha256=
|
1
|
+
foamlib/__init__.py,sha256=6_yiMUG0LJCO6YJZrf7xrR_df9CNAX8P7l6VHXbYdIU,439
|
2
2
|
foamlib/_util.py,sha256=UMzXmTFgvbp46w6k3oEZJoYC98pFgEK6LN5uLOwrlCg,397
|
3
3
|
foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
foamlib/_cases/__init__.py,sha256=xnQpR64EvFtCh07qnSz7kjQ1IhJXjRDwaZWwQGZhGv4,280
|
@@ -8,12 +8,12 @@ foamlib/_cases/_sync.py,sha256=CloQgd-93jxfSXIt7J5NxcAu3N_iF3eXMKO-NfNOgi4,4522
|
|
8
8
|
foamlib/_cases/_util.py,sha256=v6sHxHCEgagsVuup0S1xJW-x9py5xj3bUye8PiFfb3o,925
|
9
9
|
foamlib/_files/__init__.py,sha256=vDkPj8u8bX_I_m2YfeKvXBgwg8D1ufyFCfHGHKN3JPQ,140
|
10
10
|
foamlib/_files/_base.py,sha256=YA5a-i5HZuA3JslCD6r-DwZzpSA8r42dqSXef286Ako,2050
|
11
|
-
foamlib/_files/_files.py,sha256=
|
11
|
+
foamlib/_files/_files.py,sha256=23KmcPohpSA7qysIgdlU1BTZM8Hv3HcnCKuQe9lPIL8,14292
|
12
12
|
foamlib/_files/_io.py,sha256=hlcqQqU-1cdIbDc3YqxnMfxALo4SFAEcRIoZM2vMtnE,2083
|
13
13
|
foamlib/_files/_parsing.py,sha256=-IgvCOFMAERNOrpw2NaHtVXubBg4Ey6xR55bzEZb2B4,7696
|
14
14
|
foamlib/_files/_serialization.py,sha256=LCeaLWtNvkcs0dfowL7nViiByxw7U_fvgueVjFliipU,3462
|
15
|
-
foamlib-0.3.
|
16
|
-
foamlib-0.3.
|
17
|
-
foamlib-0.3.
|
18
|
-
foamlib-0.3.
|
19
|
-
foamlib-0.3.
|
15
|
+
foamlib-0.3.19.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
|
16
|
+
foamlib-0.3.19.dist-info/METADATA,sha256=K4T7r8iEJ5d9pWwhVSP9YWxLicbv3JpfwOl_habajAQ,5458
|
17
|
+
foamlib-0.3.19.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
18
|
+
foamlib-0.3.19.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
|
19
|
+
foamlib-0.3.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|