foamlib 0.1.9__py3-none-any.whl → 0.1.11__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 CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.9"
1
+ __version__ = "0.1.11"
2
2
 
3
3
  from ._cases import FoamCase, AsyncFoamCase, FoamTimeDirectory, FoamCaseBase
4
4
  from ._dictionaries import (
foamlib/_dictionaries.py CHANGED
@@ -28,13 +28,9 @@ from pyparsing import (
28
28
  Group,
29
29
  Keyword,
30
30
  Literal,
31
- OneOrMore,
32
31
  Opt,
33
- Word,
34
- ZeroOrMore,
32
+ ParseException,
35
33
  common,
36
- identchars,
37
- identbodychars,
38
34
  )
39
35
 
40
36
  FoamDimensionSet = namedtuple(
@@ -78,9 +74,6 @@ A value that can be stored in an OpenFOAM dictionary.
78
74
 
79
75
  _YES = Keyword("yes").set_parse_action(lambda s, loc, tks: True)
80
76
  _NO = Keyword("no").set_parse_action(lambda s, loc, tks: False)
81
- _WORDS = OneOrMore(Word(identchars, identbodychars + "(),")).set_parse_action(
82
- lambda s, loc, tks: " ".join(tks)
83
- )
84
77
  _VALUE = Forward()
85
78
  _LIST = Opt(
86
79
  Literal("List") + Literal("<") + common.identifier + Literal(">")
@@ -88,7 +81,7 @@ _LIST = Opt(
88
81
  (
89
82
  Opt(common.integer).suppress()
90
83
  + Literal("(").suppress()
91
- + Group(ZeroOrMore(_VALUE))
84
+ + Group(_VALUE[...])
92
85
  + Literal(")").suppress()
93
86
  )
94
87
  | (
@@ -105,13 +98,14 @@ _DIMENSIONED = (common.identifier + _DIMENSIONS + _VALUE).set_parse_action(
105
98
  lambda s, loc, tks: FoamDimensioned(tks[0], tks[1], tks[2].as_list())
106
99
  )
107
100
 
108
- _VALUE << (
109
- _FIELD | _LIST | _DIMENSIONED | _DIMENSIONS | common.number | _YES | _NO | _WORDS
110
- )
101
+ _VALUE << (_FIELD | _LIST | _DIMENSIONED | _DIMENSIONS | common.number | _YES | _NO)
111
102
 
112
103
 
113
104
  def _parse(value: str) -> FoamValue:
114
- return cast(FoamValue, _VALUE.parse_string(value, parse_all=True).as_list()[0])
105
+ try:
106
+ return cast(FoamValue, _VALUE.parse_string(value, parse_all=True).as_list()[0])
107
+ except ParseException:
108
+ return value
115
109
 
116
110
 
117
111
  def _serialize_bool(value: Any) -> str:
@@ -342,7 +336,7 @@ class FoamBoundaryDictionary(FoamDictionary):
342
336
  int,
343
337
  float,
344
338
  Sequence[Union[int, float, Sequence[Union[int, float]]]],
345
- NDArray[np.generic],
339
+ "NDArray[np.generic]",
346
340
  ],
347
341
  ) -> None:
348
342
  self["value"] = value
@@ -435,7 +429,7 @@ class FoamFieldFile(FoamFile):
435
429
  int,
436
430
  float,
437
431
  Sequence[Union[int, float, Sequence[Union[int, float]]]],
438
- NDArray[np.generic],
432
+ "NDArray[np.generic]",
439
433
  ],
440
434
  ) -> None:
441
435
  self["internalField"] = value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.1.9
3
+ Version: 0.1.11
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
@@ -0,0 +1,10 @@
1
+ foamlib/__init__.py,sha256=Yt657h80hTzIlS5ltST6lIrCuiQOGqnECOxypVkK5j8,551
2
+ foamlib/_cases.py,sha256=Q5c8vPzKT5coOy4q_H6s5gHgEArhLHByh6GSvDVCRdY,20683
3
+ foamlib/_dictionaries.py,sha256=AULIlromcGa861x-_bmQ-frfVoGdJGxYGxW-ozIl7Mo,12944
4
+ foamlib/_subprocesses.py,sha256=5vqdQvpN_2v4GgDqxi-s88NGhZ6doFxkh0XY89ZWuHA,1926
5
+ foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ foamlib-0.1.11.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
7
+ foamlib-0.1.11.dist-info/METADATA,sha256=UrHti4Ff__xTo1Go4HZV9QoVftLYd-c_VXTR1CIsc94,4527
8
+ foamlib-0.1.11.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
+ foamlib-0.1.11.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
10
+ foamlib-0.1.11.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- foamlib/__init__.py,sha256=BmI64MQCGyuDytUoTHlKOzKRZ5_WgQ_8mmzZ0svKnS4,550
2
- foamlib/_cases.py,sha256=Q5c8vPzKT5coOy4q_H6s5gHgEArhLHByh6GSvDVCRdY,20683
3
- foamlib/_dictionaries.py,sha256=zB4Ubceytn_AurfMwXMgbqfVMX4jmcMhBmgjAsK70yI,13077
4
- foamlib/_subprocesses.py,sha256=5vqdQvpN_2v4GgDqxi-s88NGhZ6doFxkh0XY89ZWuHA,1926
5
- foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- foamlib-0.1.9.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
7
- foamlib-0.1.9.dist-info/METADATA,sha256=dGu57cfJ7lEfiec_q-se_ihdl9KC5ZWJNJetGkdPmv0,4526
8
- foamlib-0.1.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
9
- foamlib-0.1.9.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
10
- foamlib-0.1.9.dist-info/RECORD,,