FourCIPP 1.24.0__tar.gz → 1.25.0__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.
- {fourcipp-1.24.0/src/FourCIPP.egg-info → fourcipp-1.25.0}/PKG-INFO +1 -1
- {fourcipp-1.24.0 → fourcipp-1.25.0/src/FourCIPP.egg-info}/PKG-INFO +1 -1
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/inline_dat.py +8 -5
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/metadata.py +1 -1
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/version.py +3 -3
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_inline_dat.py +21 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.coveragerc +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.github/workflows/check_code.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.github/workflows/publish_pypi.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.github/workflows/run_testsuite.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.github/workflows/tag_version.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.github/workflows/update_4C_metadata_schema_file.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.gitignore +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/.pre-commit-config.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/LICENSE +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/README.md +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/docs/assets/fourcipp_logo_black.svg +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/docs/assets/fourcipp_logo_white.svg +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/pyproject.toml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/requirements.in +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/requirements.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/setup.cfg +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/FourCIPP.egg-info/SOURCES.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/FourCIPP.egg-info/dependency_links.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/FourCIPP.egg-info/entry_points.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/FourCIPP.egg-info/requires.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/FourCIPP.egg-info/top_level.txt +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/config/4C_metadata.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/config/4C_schema.json +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/config/config.yaml +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/fourc_input.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/element.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/node.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/node_topology.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/legacy_io/particle.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/cli.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/configuration.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/converter.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/dict_utils.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/not_set.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/type_hinting.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/validation.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/src/fourcipp/utils/yaml_io.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/conftest.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_element.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_legacy_io.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_node.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_node_topology.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/test_particle.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/legacy_io/utils.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/test_fourc_input.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/test_readme_quickstart_example.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/__init__.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_configuration.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_converter.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_dict_utils.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_metadata.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_not_set.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_validation.py +0 -0
- {fourcipp-1.24.0 → fourcipp-1.25.0}/tests/fourcipp/utils/test_yaml_io.py +0 -0
|
@@ -121,12 +121,15 @@ def _entry_casting_factory(spec: dict) -> LineListExtractor:
|
|
|
121
121
|
Returns:
|
|
122
122
|
Casting function for the spec
|
|
123
123
|
"""
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
|
|
125
|
+
primitive_extractors = Primitive.PRIMITIVE_TYPES_TO_PYTHON.copy()
|
|
126
|
+
primitive_extractors["bool"] = lambda v: {"true": True, "false": False}[v]
|
|
127
|
+
|
|
128
|
+
if spec["type"] in primitive_extractors:
|
|
129
|
+
extractor = primitive_extractors[spec["type"]]
|
|
130
|
+
return partial(_extract_entry, extractor=extractor)
|
|
128
131
|
elif spec["type"] == "vector":
|
|
129
|
-
value_type =
|
|
132
|
+
value_type = primitive_extractors[spec["value_type"]["type"]]
|
|
130
133
|
return partial(_extract_vector, extractor=value_type, size=spec["size"])
|
|
131
134
|
elif spec["type"] == "enum":
|
|
132
135
|
choices = [s["name"] for s in spec["choices"]]
|
|
@@ -295,7 +295,7 @@ class One_Of:
|
|
|
295
295
|
|
|
296
296
|
class Primitive(InputSpec):
|
|
297
297
|
PRIMITIVE_TYPES: list[str] = ["double", "bool", "int", "string", "path"]
|
|
298
|
-
PRIMITIVE_TYPES_TO_PYTHON: dict[str, type] = {
|
|
298
|
+
PRIMITIVE_TYPES_TO_PYTHON: dict[str, type | Callable] = {
|
|
299
299
|
"double": float,
|
|
300
300
|
"bool": bool,
|
|
301
301
|
"int": int,
|
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '1.
|
|
32
|
-
__version_tuple__ = version_tuple = (1,
|
|
31
|
+
__version__ = version = '1.25.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 25, 0)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'g74d5b3440'
|
|
@@ -46,6 +46,27 @@ def test_entry_casting_factory_invalid_type():
|
|
|
46
46
|
_entry_casting_factory({"type": "invalid"})
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
def test_entry_casting_factory_bool_cast():
|
|
50
|
+
"""Test bool casting."""
|
|
51
|
+
spec = {"type": "bool"}
|
|
52
|
+
cast_func = _entry_casting_factory(spec)
|
|
53
|
+
|
|
54
|
+
assert cast_func(["true"]) is True
|
|
55
|
+
assert cast_func(["false"]) is False
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@pytest.mark.parametrize(
|
|
59
|
+
"invalid_input", ["True", "False", "some text", "TRUE", "FALSE"]
|
|
60
|
+
)
|
|
61
|
+
def test_entry_casting_factory_invalid_bool_cast(invalid_input):
|
|
62
|
+
"""Test invalid bool casting."""
|
|
63
|
+
spec = {"type": "bool"}
|
|
64
|
+
cast_func = _entry_casting_factory(spec)
|
|
65
|
+
|
|
66
|
+
with pytest.raises(KeyError):
|
|
67
|
+
cast_func([invalid_input])
|
|
68
|
+
|
|
69
|
+
|
|
49
70
|
def test_casting_factory_invalid_type():
|
|
50
71
|
"""Test reading invalid types."""
|
|
51
72
|
with pytest.raises(NotImplementedError, match="First entry has to be an all_of"):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|