foamlib 0.7.1__py3-none-any.whl → 0.7.2__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.7.1"
3
+ __version__ = "0.7.2"
4
4
 
5
5
  from ._cases import (
6
6
  AsyncFoamCase,
@@ -41,7 +41,9 @@ from ._types import DataEntry, Dimensioned, DimensionSet, File
41
41
 
42
42
 
43
43
  def _list_of(entry: ParserElement) -> ParserElement:
44
- return (
44
+ return Opt(
45
+ Literal("List") + Literal("<") + _IDENTIFIER + Literal(">")
46
+ ).suppress() + (
45
47
  (
46
48
  counted_array(entry, common.integer + Literal("(").suppress())
47
49
  + Literal(")").suppress()
@@ -59,7 +61,7 @@ def _list_of(entry: ParserElement) -> ParserElement:
59
61
 
60
62
  def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
61
63
  float_pattern = r"[+-]?((\d+\.?\d*(e[+-]?\d+)?)|nan|inf(inity)?)"
62
- ignore_pattern = rf"(?:{ignore.re.pattern}|\s)+"
64
+ ignore_pattern = rf"(?:\s|{ignore.re.pattern})+"
63
65
 
64
66
  if size == 1:
65
67
  tensor_pattern = float_pattern
@@ -81,7 +83,7 @@ def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
81
83
 
82
84
  list_ <<= Regex(
83
85
  rf"\((?:{ignore_pattern})?(?:{tensor_pattern}{ignore_pattern}){{{length - 1}}}{tensor_pattern}(?:{ignore_pattern})?\)",
84
- re.IGNORECASE,
86
+ flags=re.IGNORECASE,
85
87
  )
86
88
 
87
89
  count = common.integer.add_parse_action(count_parse_action)
@@ -89,19 +91,18 @@ def _counted_tensor_list(*, size: int, ignore: Regex) -> ParserElement:
89
91
  def list_parse_action(
90
92
  tks: ParseResults,
91
93
  ) -> list[list[float]] | list[list[list[float]]]:
92
- values = (
93
- re.sub(ignore.re, " ", tks[0]).replace("(", " ").replace(")", " ").split()
94
- )
94
+ values = [
95
+ float(v)
96
+ for v in re.sub(ignore.re, " ", tks[0])
97
+ .replace("(", " ")
98
+ .replace(")", " ")
99
+ .split()
100
+ ]
95
101
 
96
102
  if size == 1:
97
- return [[float(v) for v in values]]
103
+ return [values]
98
104
 
99
- return [
100
- [
101
- [float(v) for v in values[i : i + size]]
102
- for i in range(0, len(values), size)
103
- ]
104
- ]
105
+ return [[values[i : i + size] for i in range(0, len(values), size)]]
105
106
 
106
107
  list_.add_parse_action(list_parse_action)
107
108
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foamlib
3
- Version: 0.7.1
3
+ Version: 0.7.2
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,4 +1,4 @@
1
- foamlib/__init__.py,sha256=FH3qcxKWITL8HKS4m81vo9oCCM3ckcC2f3rOtzOia_w,452
1
+ foamlib/__init__.py,sha256=YrFnCARXwvjW-QZzK9cS_ivto2gvTEJwdSVU5ZfCBkM,452
2
2
  foamlib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  foamlib/_cases/__init__.py,sha256=wTUHcUgU1CBgpu0cUMtksQ5VKG6B8CFu9xc3dWwsQuo,358
4
4
  foamlib/_cases/_async.py,sha256=i6g4EBHqvI-1PkdrxsRto2ynW7sxsOga2bSYk1XVG1U,7795
@@ -11,12 +11,12 @@ foamlib/_cases/_util.py,sha256=lhVca3ERY0zwYjDam6W2QMROt0yX5vAF-9_DS5RuMbM,1547
11
11
  foamlib/_files/__init__.py,sha256=GDkYkF3F-ADhkCRT3j9dQQHPP5LyJJYb8TaBbZTQ6fo,96
12
12
  foamlib/_files/_files.py,sha256=LVLMeP9Zt9esuVGhntnjBA4_u_NhiX5xkm09Qemcle8,15846
13
13
  foamlib/_files/_io.py,sha256=IQLqoqnA1TpHf21NbUho2wsYWevyqC6MKo-wfpaObUU,2226
14
- foamlib/_files/_parsing.py,sha256=pJzlzFeiT6MDNeCoxfIUvTdrgG7MMqQdL0T-64ZANqk,15371
14
+ foamlib/_files/_parsing.py,sha256=D1l7j_KldD6h-iJvFT6c0CiwctWvUxeGJxh-J93zDs8,15430
15
15
  foamlib/_files/_serialization.py,sha256=0vqJxltjscqp16mIvd0iKXbeRMbq3a7uLG2INWxzCBg,5861
16
16
  foamlib/_files/_types.py,sha256=eY06nox8cZe6FixUQigvZRV9Fc7gwehJxuQz_wCCnqo,1678
17
17
  foamlib/_files/_util.py,sha256=O9t2W26XDs63cVLroW8rZ35Puas20NhnKr_gLMlZixI,493
18
- foamlib-0.7.1.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
19
- foamlib-0.7.1.dist-info/METADATA,sha256=N6QL29i-hDl1ZrKrC7Lm99A3p1Fx7dgCtz21lXPXrOA,7957
20
- foamlib-0.7.1.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
21
- foamlib-0.7.1.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
22
- foamlib-0.7.1.dist-info/RECORD,,
18
+ foamlib-0.7.2.dist-info/LICENSE.txt,sha256=5Dte9TUnLZzPRs4NQzl-Jc2-Ljd-t_v0ZR5Ng5r0UsY,35131
19
+ foamlib-0.7.2.dist-info/METADATA,sha256=dK_DN2ZLU49org-G_XI4kdNDg551I8b68d52Q4cAePU,7957
20
+ foamlib-0.7.2.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
21
+ foamlib-0.7.2.dist-info/top_level.txt,sha256=ZdVYtetXGwPwyfL-WhlhbTFQGAwKX5P_gXxtH9JYFPI,8
22
+ foamlib-0.7.2.dist-info/RECORD,,