foamlib 0.8.7__py3-none-any.whl → 0.8.8__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,6 +1,6 @@
1
1
  """A Python interface for interacting with OpenFOAM."""
2
2
 
3
- __version__ = "0.8.7"
3
+ __version__ = "0.8.8"
4
4
 
5
5
  from ._cases import (
6
6
  AsyncFoamCase,
foamlib/_cases/_run.py CHANGED
@@ -261,17 +261,19 @@ class FoamCaseRunBase(FoamCaseBase):
261
261
 
262
262
  return script
263
263
 
264
+ @staticmethod
265
+ def __cmd_name(cmd: Sequence[str | os.PathLike[str]] | str) -> str:
266
+ if isinstance(cmd, str):
267
+ cmd = shlex.split(cmd)
268
+
269
+ return Path(cmd[0]).name
270
+
264
271
  @contextmanager
265
272
  def __output(
266
273
  self, cmd: Sequence[str | os.PathLike[str]] | str, *, log: bool
267
274
  ) -> Generator[tuple[int | IO[str], int | IO[str]], None, None]:
268
275
  if log:
269
- if isinstance(cmd, str):
270
- name = shlex.split(cmd)[0]
271
- else:
272
- name = Path(cmd[0]).name if isinstance(cmd[0], os.PathLike) else cmd[0]
273
-
274
- with (self.path / f"log.{name}").open("a") as stdout:
276
+ with (self.path / f"log.{self.__cmd_name(cmd)}").open("a") as stdout:
275
277
  yield stdout, STDOUT
276
278
  else:
277
279
  yield DEVNULL, DEVNULL
@@ -280,11 +282,6 @@ class FoamCaseRunBase(FoamCaseBase):
280
282
  def __process_stdout(
281
283
  self, cmd: Sequence[str | os.PathLike[str]] | str
282
284
  ) -> Generator[Callable[[str], None], None, None]:
283
- if isinstance(cmd, str):
284
- name = shlex.split(cmd)[0]
285
- else:
286
- name = Path(cmd[0]).name if isinstance(cmd[0], os.PathLike) else cmd[0]
287
-
288
285
  try:
289
286
  with self.control_dict as control_dict:
290
287
  if control_dict["stopAt"] == "endTime":
@@ -299,7 +296,9 @@ class FoamCaseRunBase(FoamCaseBase):
299
296
  end_time = None
300
297
 
301
298
  with self.__progress as progress:
302
- task = progress.add_task(f"({self.name}) Running {name}...", total=None)
299
+ task = progress.add_task(
300
+ f"({self.name}) Running {self.__cmd_name(cmd)}...", total=None
301
+ )
303
302
 
304
303
  def process_stdout(line: str) -> None:
305
304
  if line.startswith("Time = "):
@@ -214,6 +214,8 @@ _COMMENT = Regex(r"(?:/\*(?:[^*]|\*(?!/))*\*/)|(?://(?:\\\n|[^\n])*)")
214
214
  _IDENTCHARS = identchars + "$"
215
215
  _IDENTBODYCHARS = (
216
216
  printables.replace(";", "")
217
+ .replace("(", "")
218
+ .replace(")", "")
217
219
  .replace("{", "")
218
220
  .replace("}", "")
219
221
  .replace("[", "")
@@ -243,10 +245,12 @@ _TENSOR = (
243
245
  | _tensor(TensorKind.TENSOR)
244
246
  )
245
247
  _PARENTHESIZED = Forward()
246
- _IDENTIFIER = Combine(
247
- Word(_IDENTCHARS, _IDENTBODYCHARS, exclude_chars="()") + Opt(_PARENTHESIZED)
248
+ _IDENTIFIER = Combine(Word(_IDENTCHARS, _IDENTBODYCHARS) + Opt(_PARENTHESIZED))
249
+ _PARENTHESIZED <<= Combine(
250
+ Literal("(")
251
+ + (_PARENTHESIZED | Word(_IDENTBODYCHARS) + Opt(_PARENTHESIZED))
252
+ + Literal(")")
248
253
  )
249
- _PARENTHESIZED <<= Combine(Literal("(") + (_PARENTHESIZED | _IDENTIFIER) + Literal(")"))
250
254
 
251
255
  _DIMENSIONED = (Opt(_IDENTIFIER) + _DIMENSIONS + _TENSOR).set_parse_action(
252
256
  lambda tks: Dimensioned(*reversed(tks.as_list()))
@@ -261,7 +265,7 @@ _FIELD = (Keyword("uniform", _IDENTBODYCHARS).suppress() + _TENSOR) | (
261
265
  )
262
266
  )
263
267
  _DIRECTIVE = Word("#", _IDENTBODYCHARS)
264
- _TOKEN = dbl_quoted_string | _IDENTIFIER | _DIRECTIVE
268
+ _TOKEN = dbl_quoted_string | _DIRECTIVE | _IDENTIFIER
265
269
  _DATA = Forward()
266
270
  _KEYWORD_ENTRY = _keyword_entry_of(_TOKEN | _list_of(_IDENTIFIER), _DATA)
267
271
  _DICT = _dict_of(_TOKEN, _DATA)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: foamlib
3
- Version: 0.8.7
3
+ Version: 0.8.8
4
4
  Summary: A Python interface for interacting with OpenFOAM
5
5
  Project-URL: Homepage, https://github.com/gerlero/foamlib
6
6
  Project-URL: Repository, https://github.com/gerlero/foamlib
@@ -29,11 +29,11 @@ Requires-Dist: aioshutil<2,>=1
29
29
  Requires-Dist: numpy<3,>=1
30
30
  Requires-Dist: numpy<3,>=1.25.0; python_version >= '3.10'
31
31
  Requires-Dist: pyparsing<4,>=3.1.2
32
- Requires-Dist: rich<14,>=13
32
+ Requires-Dist: rich<15,>=13
33
33
  Requires-Dist: typing-extensions<5,>=4; python_version < '3.11'
34
34
  Provides-Extra: dev
35
35
  Requires-Dist: mypy<2,>=1; extra == 'dev'
36
- Requires-Dist: pytest-asyncio<0.26,>=0.21; extra == 'dev'
36
+ Requires-Dist: pytest-asyncio<0.27,>=0.21; extra == 'dev'
37
37
  Requires-Dist: pytest-cov; extra == 'dev'
38
38
  Requires-Dist: pytest<9,>=7; extra == 'dev'
39
39
  Requires-Dist: ruff; extra == 'dev'
@@ -45,12 +45,12 @@ Requires-Dist: sphinx<9,>=5; extra == 'docs'
45
45
  Provides-Extra: lint
46
46
  Requires-Dist: ruff; extra == 'lint'
47
47
  Provides-Extra: test
48
- Requires-Dist: pytest-asyncio<0.26,>=0.21; extra == 'test'
48
+ Requires-Dist: pytest-asyncio<0.27,>=0.21; extra == 'test'
49
49
  Requires-Dist: pytest-cov; extra == 'test'
50
50
  Requires-Dist: pytest<9,>=7; extra == 'test'
51
51
  Provides-Extra: typing
52
52
  Requires-Dist: mypy<2,>=1; extra == 'typing'
53
- Requires-Dist: pytest-asyncio<0.26,>=0.21; extra == 'typing'
53
+ Requires-Dist: pytest-asyncio<0.27,>=0.21; extra == 'typing'
54
54
  Requires-Dist: pytest-cov; extra == 'typing'
55
55
  Requires-Dist: pytest<9,>=7; extra == 'typing'
56
56
  Description-Content-Type: text/markdown
@@ -1,9 +1,9 @@
1
- foamlib/__init__.py,sha256=TrTrsv_QjPqa16duuXQl5FgjxRPwuHlhO-MHOtxUzdY,452
1
+ foamlib/__init__.py,sha256=ef8IIQjKj7fPW-7t7Oeo-bUD9Wy3bJY5Q63lobifP7o,452
2
2
  foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  foamlib/_cases/__init__.py,sha256=_A1TTHuQfS9FH2_33lSEyLtOJZGFHZBco1tWJCVOHks,358
4
4
  foamlib/_cases/_async.py,sha256=vXpq5T2gDomuawARsLaUEMjUBhMsZK58q7iVwQpXsYE,7903
5
5
  foamlib/_cases/_base.py,sha256=37oBbM3NM-hpG7dKewZvyJNtqSAogMurcbmX-wLIgMU,6727
6
- foamlib/_cases/_run.py,sha256=IRsozHdXx5tjLYYIWMiKGeaf5188unhp5VwIAZLlr3E,15578
6
+ foamlib/_cases/_run.py,sha256=L2q9wab_pIbDpqC_N59ZpatgvjuDzQAWllQMyOHb1Hk,15475
7
7
  foamlib/_cases/_slurm.py,sha256=Hzpf5Ugahwq7sUsCfhZ6JgXDOdkoYGGsHGiO7NV8uFs,2331
8
8
  foamlib/_cases/_subprocess.py,sha256=VHV2SuOLqa711an6kCuvN6UlIkeh4qqFfdrpNoKzQps,5630
9
9
  foamlib/_cases/_sync.py,sha256=e06aGGZ9n6WTWK9eWZhrezsT4yebGhKPE0sn0nwQH8A,5977
@@ -11,10 +11,10 @@ foamlib/_cases/_util.py,sha256=QCizfbuJdOCeF9ogU2R-y-iWX5kfaOA4U2W68t6QlOM,2544
11
11
  foamlib/_files/__init__.py,sha256=q1vkjXnjnSZvo45jPAICpWeF2LZv5V6xfzAR6S8fS5A,96
12
12
  foamlib/_files/_files.py,sha256=YAKw3RHEw8eCja4JAxobp6BC-2Kyy7AvG1O7yOqyMic,15414
13
13
  foamlib/_files/_io.py,sha256=BGbbm6HKxL2ka0YMCmHqZQZ1R4PPQlkvWWb4FHMAS8k,2217
14
- foamlib/_files/_parsing.py,sha256=XrqG8IcTM--qZYqEHYO_jcCTb7ev9M9kz75T_DQtPuc,14047
14
+ foamlib/_files/_parsing.py,sha256=IB6c9mc0AM_z_Gh7K82Z1ANseGaNwmzUo8AYv3pxEBw,14111
15
15
  foamlib/_files/_serialization.py,sha256=PvMzNyTja6OKT_GUfExTulx9nMLBjfu0-9yThCKbvxs,5227
16
16
  foamlib/_files/_types.py,sha256=m-fFjJnS4sFSavDsijlXpAfEhnbh10RBumSHAT0GOgQ,3408
17
- foamlib-0.8.7.dist-info/METADATA,sha256=HVzB10Bdz97hbXxBDunpGy-_seeNduk5msDAKVCXmx4,7996
18
- foamlib-0.8.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
- foamlib-0.8.7.dist-info/licenses/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
20
- foamlib-0.8.7.dist-info/RECORD,,
17
+ foamlib-0.8.8.dist-info/METADATA,sha256=DdEh3U5bZ9VZmxA-3-0GlMgl_XNlPhwRDdE_K41bvT4,7996
18
+ foamlib-0.8.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
+ foamlib-0.8.8.dist-info/licenses/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
20
+ foamlib-0.8.8.dist-info/RECORD,,