foamlib 0.3.18__tar.gz → 0.3.19__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.
Files changed (24) hide show
  1. {foamlib-0.3.18 → foamlib-0.3.19}/PKG-INFO +1 -1
  2. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/__init__.py +1 -1
  3. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/_files.py +18 -18
  4. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib.egg-info/PKG-INFO +1 -1
  5. {foamlib-0.3.18 → foamlib-0.3.19}/LICENSE.txt +0 -0
  6. {foamlib-0.3.18 → foamlib-0.3.19}/README.md +0 -0
  7. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_cases/__init__.py +0 -0
  8. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_cases/_async.py +0 -0
  9. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_cases/_base.py +0 -0
  10. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_cases/_sync.py +0 -0
  11. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_cases/_util.py +0 -0
  12. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/__init__.py +0 -0
  13. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/_base.py +0 -0
  14. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/_io.py +0 -0
  15. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/_parsing.py +0 -0
  16. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_files/_serialization.py +0 -0
  17. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/_util.py +0 -0
  18. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib/py.typed +0 -0
  19. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib.egg-info/SOURCES.txt +0 -0
  20. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib.egg-info/dependency_links.txt +0 -0
  21. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib.egg-info/requires.txt +0 -0
  22. {foamlib-0.3.18 → foamlib-0.3.19}/foamlib.egg-info/top_level.txt +0 -0
  23. {foamlib-0.3.18 → foamlib-0.3.19}/pyproject.toml +0 -0
  24. {foamlib-0.3.18 → foamlib-0.3.19}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.3.18
3
+ Version: 0.3.19
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
@@ -1,6 +1,6 @@
1
1
  """A Python interface for interacting with OpenFOAM."""
2
2
 
3
- __version__ = "0.3.18"
3
+ __version__ = "0.3.19"
4
4
 
5
5
  from ._cases import (
6
6
  AsyncFoamCase,
@@ -149,7 +149,7 @@ class FoamFile(
149
149
  return ret
150
150
 
151
151
  @property
152
- def header(self) -> "FoamFile.Header":
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 = Kind.BINARY_FIELD if self._binary else Kind.FIELD
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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.3.18
3
+ Version: 0.3.19
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes