FourCIPP 1.14.0__py3-none-any.whl → 1.16.0__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.
- fourcipp/config/4C_metadata.yaml +1662 -1690
- fourcipp/config/4C_schema.json +8189 -8224
- fourcipp/fourc_input.py +3 -3
- fourcipp/legacy_io/__init__.py +1 -1
- fourcipp/legacy_io/element.py +1 -1
- fourcipp/legacy_io/inline_dat.py +8 -6
- fourcipp/legacy_io/particle.py +1 -1
- fourcipp/utils/cli.py +1 -1
- fourcipp/utils/configuration.py +1 -1
- fourcipp/utils/metadata.py +994 -9
- fourcipp/utils/not_set.py +21 -8
- fourcipp/utils/{typing.py → type_hinting.py} +5 -0
- fourcipp/utils/yaml_io.py +1 -1
- fourcipp/version.py +2 -2
- {fourcipp-1.14.0.dist-info → fourcipp-1.16.0.dist-info}/METADATA +1 -1
- fourcipp-1.16.0.dist-info/RECORD +28 -0
- fourcipp-1.14.0.dist-info/RECORD +0 -28
- {fourcipp-1.14.0.dist-info → fourcipp-1.16.0.dist-info}/WHEEL +0 -0
- {fourcipp-1.14.0.dist-info → fourcipp-1.16.0.dist-info}/entry_points.txt +0 -0
- {fourcipp-1.14.0.dist-info → fourcipp-1.16.0.dist-info}/licenses/LICENSE +0 -0
- {fourcipp-1.14.0.dist-info → fourcipp-1.16.0.dist-info}/top_level.txt +0 -0
fourcipp/fourc_input.py
CHANGED
|
@@ -41,8 +41,8 @@ from fourcipp.utils.dict_utils import (
|
|
|
41
41
|
compare_nested_dicts_or_lists,
|
|
42
42
|
sort_by_key_order,
|
|
43
43
|
)
|
|
44
|
-
from fourcipp.utils.not_set import
|
|
45
|
-
from fourcipp.utils.
|
|
44
|
+
from fourcipp.utils.not_set import NOT_SET, check_if_set
|
|
45
|
+
from fourcipp.utils.type_hinting import Path
|
|
46
46
|
from fourcipp.utils.validation import ValidationError, validate_using_json_schema
|
|
47
47
|
from fourcipp.utils.yaml_io import dump_yaml, load_yaml
|
|
48
48
|
|
|
@@ -289,7 +289,7 @@ class FourCInput:
|
|
|
289
289
|
f"Section '{key}' not set. Did out mean '{difflib.get_close_matches(key.upper(), self.all_sections_names, n=1, cutoff=0.3)[0]}'? The set sections are:\n - {sections}"
|
|
290
290
|
)
|
|
291
291
|
|
|
292
|
-
def pop(self, key: str, default_value: Any =
|
|
292
|
+
def pop(self, key: str, default_value: Any = NOT_SET) -> Any:
|
|
293
293
|
"""Pop entry.
|
|
294
294
|
|
|
295
295
|
Args:
|
fourcipp/legacy_io/__init__.py
CHANGED
|
@@ -27,7 +27,7 @@ from fourcipp.legacy_io.element import read_element, write_element
|
|
|
27
27
|
from fourcipp.legacy_io.node import read_node, write_node
|
|
28
28
|
from fourcipp.legacy_io.node_topology import read_node_topology, write_node_topology
|
|
29
29
|
from fourcipp.legacy_io.particle import read_particle, write_particle
|
|
30
|
-
from fourcipp.utils.
|
|
30
|
+
from fourcipp.utils.type_hinting import T
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
def _iterate_and_evaluate(function: Callable[..., T], iterable: Sequence) -> list[T]:
|
fourcipp/legacy_io/element.py
CHANGED
|
@@ -30,7 +30,7 @@ from fourcipp.legacy_io.inline_dat import (
|
|
|
30
30
|
nested_casting_factory,
|
|
31
31
|
to_dat_string,
|
|
32
32
|
)
|
|
33
|
-
from fourcipp.utils.
|
|
33
|
+
from fourcipp.utils.type_hinting import LineCastingDict
|
|
34
34
|
|
|
35
35
|
ElementCastingDict: TypeAlias = dict[str, dict[str, LineCastingDict]]
|
|
36
36
|
|
fourcipp/legacy_io/inline_dat.py
CHANGED
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
from functools import partial
|
|
25
25
|
from typing import Any
|
|
26
26
|
|
|
27
|
-
from fourcipp.utils.metadata import
|
|
28
|
-
from fourcipp.utils.
|
|
27
|
+
from fourcipp.utils.metadata import Primitive
|
|
28
|
+
from fourcipp.utils.type_hinting import (
|
|
29
29
|
Extractor,
|
|
30
30
|
LineCastingDict,
|
|
31
31
|
LineListExtractor,
|
|
@@ -34,7 +34,7 @@ from fourcipp.utils.typing import (
|
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
# Metadata types currently supported
|
|
37
|
-
SUPPORTED_METADATA_TYPES =
|
|
37
|
+
SUPPORTED_METADATA_TYPES = Primitive.PRIMITIVE_TYPES + ["enum", "vector"]
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def to_dat_string(object: Any) -> str:
|
|
@@ -121,10 +121,12 @@ def _entry_casting_factory(spec: dict) -> LineListExtractor:
|
|
|
121
121
|
Returns:
|
|
122
122
|
Casting function for the spec
|
|
123
123
|
"""
|
|
124
|
-
if spec["type"] in
|
|
125
|
-
return partial(
|
|
124
|
+
if spec["type"] in Primitive.PRIMITIVE_TYPES_TO_PYTHON:
|
|
125
|
+
return partial(
|
|
126
|
+
_extract_entry, extractor=Primitive.PRIMITIVE_TYPES_TO_PYTHON[spec["type"]]
|
|
127
|
+
)
|
|
126
128
|
elif spec["type"] == "vector":
|
|
127
|
-
value_type =
|
|
129
|
+
value_type = Primitive.PRIMITIVE_TYPES_TO_PYTHON[spec["value_type"]["type"]]
|
|
128
130
|
return partial(_extract_vector, extractor=value_type, size=spec["size"])
|
|
129
131
|
elif spec["type"] == "enum":
|
|
130
132
|
choices = [s["name"] for s in spec["choices"]]
|
fourcipp/legacy_io/particle.py
CHANGED
|
@@ -31,7 +31,7 @@ from fourcipp.legacy_io.inline_dat import (
|
|
|
31
31
|
inline_dat_read,
|
|
32
32
|
to_dat_string,
|
|
33
33
|
)
|
|
34
|
-
from fourcipp.utils.
|
|
34
|
+
from fourcipp.utils.type_hinting import LineCastingDict
|
|
35
35
|
|
|
36
36
|
_particle_casting = casting_factory(CONFIG.fourc_metadata["legacy_particle_specs"])
|
|
37
37
|
|
fourcipp/utils/cli.py
CHANGED
fourcipp/utils/configuration.py
CHANGED
|
@@ -28,7 +28,7 @@ from dataclasses import dataclass, field
|
|
|
28
28
|
|
|
29
29
|
from loguru import logger
|
|
30
30
|
|
|
31
|
-
from fourcipp.utils.
|
|
31
|
+
from fourcipp.utils.type_hinting import Path
|
|
32
32
|
from fourcipp.utils.yaml_io import dump_yaml, load_yaml
|
|
33
33
|
|
|
34
34
|
CONFIG_PACKAGE: pathlib.Path = pathlib.Path(__file__).parents[1] / "config"
|