foamlib 0.3.22__tar.gz → 0.3.23__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.22 → foamlib-0.3.23}/PKG-INFO +1 -1
  2. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/__init__.py +1 -1
  3. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/_files.py +8 -2
  4. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/_parsing.py +3 -1
  5. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib.egg-info/PKG-INFO +1 -1
  6. {foamlib-0.3.22 → foamlib-0.3.23}/LICENSE.txt +0 -0
  7. {foamlib-0.3.22 → foamlib-0.3.23}/README.md +0 -0
  8. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_cases/__init__.py +0 -0
  9. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_cases/_async.py +0 -0
  10. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_cases/_base.py +0 -0
  11. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_cases/_sync.py +0 -0
  12. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_cases/_util.py +0 -0
  13. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/__init__.py +0 -0
  14. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/_base.py +0 -0
  15. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/_io.py +0 -0
  16. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_files/_serialization.py +0 -0
  17. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/_util.py +0 -0
  18. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib/py.typed +0 -0
  19. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib.egg-info/SOURCES.txt +0 -0
  20. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib.egg-info/dependency_links.txt +0 -0
  21. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib.egg-info/requires.txt +0 -0
  22. {foamlib-0.3.22 → foamlib-0.3.23}/foamlib.egg-info/top_level.txt +0 -0
  23. {foamlib-0.3.22 → foamlib-0.3.23}/pyproject.toml +0 -0
  24. {foamlib-0.3.22 → foamlib-0.3.23}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.3.22
3
+ Version: 0.3.23
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.22"
3
+ __version__ = "0.3.23"
4
4
 
5
5
  from ._cases import (
6
6
  AsyncFoamCase,
@@ -220,7 +220,8 @@ class FoamFile(
220
220
 
221
221
  self._write(
222
222
  contents[:start]
223
- + b"\n"
223
+ + (b"\n" if contents[start - 1 : start] != b"\n" else b"")
224
+ + (b" " * (len(keywords) - 1) if keywords else b"")
224
225
  + dumpb({keywords[-1]: {}})
225
226
  + b"\n"
226
227
  + contents[end:]
@@ -251,7 +252,12 @@ class FoamFile(
251
252
 
252
253
  self._write(
253
254
  contents[:start]
254
- + b"\n"
255
+ + (
256
+ b"\n"
257
+ if start > 0 and contents[start - 1 : start] != b"\n"
258
+ else b""
259
+ )
260
+ + (b" " * (len(keywords) - 1) if keywords else b"")
255
261
  + dumpb({keywords[-1]: data}, kind=kind)
256
262
  + b"\n"
257
263
  + contents[end:]
@@ -184,6 +184,8 @@ class Parsed(Mapping[Tuple[str, ...], Union[FoamDict.Data, EllipsisType]]):
184
184
  Tuple[str, ...],
185
185
  Tuple[int, Union[FoamDict.Data, EllipsisType], int],
186
186
  ] = {}
187
+ self._end = len(contents)
188
+
187
189
  for parse_result in _FILE.parse_string(
188
190
  contents.decode("latin-1"), parse_all=True
189
191
  ):
@@ -242,7 +244,7 @@ class Parsed(Mapping[Tuple[str, ...], Union[FoamDict.Data, EllipsisType]]):
242
244
  _, _, end = self._parsed[keywords[:-1]]
243
245
  end -= 1
244
246
  else:
245
- end = -1
247
+ end = self._end
246
248
 
247
249
  start = end
248
250
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.3.22
3
+ Version: 0.3.23
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