nerdd-module 0.3.40__tar.gz → 0.3.42__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.
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/PKG-INFO +1 -1
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/models.py +58 -1
- nerdd_module-0.3.42/nerdd_module/converters/basic_type_converter.py +49 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/predictions.py +10 -2
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module.egg-info/PKG-INFO +1 -1
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/pyproject.toml +1 -1
- nerdd_module-0.3.40/nerdd_module/converters/basic_type_converter.py +0 -23
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/LICENSE +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/README.md +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/cli.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/default_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/dict_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/merged_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/package_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/search_yaml_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/yaml_configuration.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/converter_config.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/mol_converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/problem_list_converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/representation_converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/source_list_converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/void_converter.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/depth_first_explorer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/explorer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/file_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/gzip_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/inchi_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/list_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/mol_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/reader_config.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/sdf_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/smiles_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/string_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/tar_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/input/zip_reader.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/assign_name_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/convert_representations_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/enforce_schema_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/model.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/prediction_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/read_input_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/write_output_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/csv_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/file_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/iterator_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/pandas_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/record_list_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/sdf_writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/writer.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/output/writer_config.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/block_logs.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/files.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/get_entry_points.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/literal.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/typed_dict.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/types.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/polyfills/version.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/check_valid_smiles.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/chembl_structure_pipeline.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/filter_by_element.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/filter_by_weight.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/preprocessing_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/remove_small_fragments.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/remove_stereochemistry.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/sanitize.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/problem.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/py.typed +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/steps/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/steps/map_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/steps/output_step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/steps/step.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/checks.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/files.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/models/AtomicMassModel.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/models/MolWeightModel.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/models/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/preprocessing/DummyPreprocessingStep.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/preprocessing/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/tests/representations.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/util/__init__.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/util/call_with_mappings.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/util/package.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/version.py +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module.egg-info/SOURCES.txt +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module.egg-info/dependency_links.txt +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module.egg-info/requires.txt +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module.egg-info/top_level.txt +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/setup.cfg +0 -0
- {nerdd_module-0.3.40 → nerdd_module-0.3.42}/tests/test_features.py +0 -0
|
@@ -51,15 +51,50 @@ class Choice(BaseModel):
|
|
|
51
51
|
label: Optional[str] = None
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
JobType = Literal["int", "integer", "float", "bool", "boolean", "str", "string"]
|
|
55
|
+
|
|
56
|
+
|
|
54
57
|
class JobParameter(BaseModel):
|
|
55
58
|
name: str
|
|
56
|
-
type:
|
|
59
|
+
type: JobType
|
|
57
60
|
visible_name: Optional[str] = None
|
|
58
61
|
help_text: Optional[str] = None
|
|
59
62
|
default: Any = None
|
|
60
63
|
required: bool = False
|
|
61
64
|
choices: Optional[List[Choice]] = None
|
|
62
65
|
|
|
66
|
+
def validate_value(self, value: Any) -> None:
|
|
67
|
+
if self.type == ["int", "integer"]:
|
|
68
|
+
if not isinstance(value, int):
|
|
69
|
+
raise ValueError(
|
|
70
|
+
f"Parameter {self.name} must be an integer, got {type(value).__name__}."
|
|
71
|
+
)
|
|
72
|
+
elif self.type == "float":
|
|
73
|
+
if not isinstance(value, (int, float)):
|
|
74
|
+
raise ValueError(
|
|
75
|
+
f"Parameter {self.name} must be a float, got {type(value).__name__}."
|
|
76
|
+
)
|
|
77
|
+
elif self.type in ["bool", "boolean"]:
|
|
78
|
+
if not isinstance(value, bool):
|
|
79
|
+
raise ValueError(
|
|
80
|
+
f"Parameter {self.name} must be a boolean, got {type(value).__name__}."
|
|
81
|
+
)
|
|
82
|
+
elif self.type in ["str", "string"]:
|
|
83
|
+
if not isinstance(value, str):
|
|
84
|
+
raise ValueError(
|
|
85
|
+
f"Parameter {self.name} must be a string, got {type(value).__name__}."
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
raise ValueError(f"Unknown type for parameter {self.name}: {self.type}")
|
|
89
|
+
|
|
90
|
+
if self.choices:
|
|
91
|
+
choice_values = [choice.value for choice in self.choices]
|
|
92
|
+
if value not in choice_values:
|
|
93
|
+
raise ValueError(
|
|
94
|
+
f"Invalid value for parameter {self.name}: {value}. "
|
|
95
|
+
f"Expected one of {choice_values}."
|
|
96
|
+
)
|
|
97
|
+
|
|
63
98
|
|
|
64
99
|
Task = Literal[
|
|
65
100
|
"molecular_property_prediction",
|
|
@@ -207,3 +242,25 @@ class Module(BaseModel):
|
|
|
207
242
|
)
|
|
208
243
|
|
|
209
244
|
return values
|
|
245
|
+
|
|
246
|
+
def validate_job_parameters(self, params: dict) -> None:
|
|
247
|
+
"""
|
|
248
|
+
Validate the job parameters against the module's job parameters.
|
|
249
|
+
Raises an error if a parameter is missing or has an invalid type.
|
|
250
|
+
"""
|
|
251
|
+
# make sure that all job parameters are present
|
|
252
|
+
for param in self.job_parameters:
|
|
253
|
+
if param.name not in params and param.required:
|
|
254
|
+
raise ValueError(f"Missing required job parameter: {param.name}")
|
|
255
|
+
|
|
256
|
+
# check that there are no additional parameters
|
|
257
|
+
param_names = {param.name for param in self.job_parameters}
|
|
258
|
+
for key in params.keys():
|
|
259
|
+
if key not in param_names:
|
|
260
|
+
raise ValueError(f"Unknown job parameter: {key}")
|
|
261
|
+
|
|
262
|
+
# validate all parameters
|
|
263
|
+
for param in self.job_parameters:
|
|
264
|
+
if param.name in params:
|
|
265
|
+
value = params[param.name]
|
|
266
|
+
param.validate_value(value)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from typing import Any, Callable
|
|
2
|
+
|
|
3
|
+
from ..config import Module, ResultProperty
|
|
4
|
+
from .converter import Converter
|
|
5
|
+
from .converter_config import ALL, ConverterConfig
|
|
6
|
+
|
|
7
|
+
__all__ = ["BasicTypeConverter", "basic_data_types"]
|
|
8
|
+
|
|
9
|
+
basic_data_types = [
|
|
10
|
+
"int",
|
|
11
|
+
"float",
|
|
12
|
+
"string",
|
|
13
|
+
"bool",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class BasicTypeConverter(Converter):
|
|
18
|
+
def __init__(
|
|
19
|
+
self,
|
|
20
|
+
module_config: Module,
|
|
21
|
+
result_property: ResultProperty,
|
|
22
|
+
output_format: str,
|
|
23
|
+
**kwargs: Any,
|
|
24
|
+
) -> None:
|
|
25
|
+
super().__init__(module_config, result_property, output_format, **kwargs)
|
|
26
|
+
self.type = self.result_property.type
|
|
27
|
+
|
|
28
|
+
self._f: Callable[[Any], Any]
|
|
29
|
+
if self.type == "int":
|
|
30
|
+
self._f = int
|
|
31
|
+
elif self.type == "float":
|
|
32
|
+
self._f = float
|
|
33
|
+
elif self.type == "string":
|
|
34
|
+
self._f = str
|
|
35
|
+
elif self.type == "bool":
|
|
36
|
+
self._f = bool
|
|
37
|
+
else:
|
|
38
|
+
self._f = lambda v: v
|
|
39
|
+
|
|
40
|
+
def _convert(self, input: Any, context: dict) -> Any:
|
|
41
|
+
if input is None:
|
|
42
|
+
return None
|
|
43
|
+
|
|
44
|
+
return self._f(input)
|
|
45
|
+
|
|
46
|
+
config = ConverterConfig(
|
|
47
|
+
data_types=basic_data_types,
|
|
48
|
+
output_formats=ALL,
|
|
49
|
+
)
|
|
@@ -52,13 +52,21 @@ def predictions_atomic_mass_model(representations, version, multiplier):
|
|
|
52
52
|
"all results are considered",
|
|
53
53
|
target_fixture="subset",
|
|
54
54
|
)
|
|
55
|
-
def
|
|
55
|
+
def all_results(predictions):
|
|
56
56
|
return predictions
|
|
57
57
|
|
|
58
58
|
@when(
|
|
59
59
|
"the subset of the result where the input was not None is considered",
|
|
60
60
|
target_fixture="subset",
|
|
61
61
|
)
|
|
62
|
-
def
|
|
62
|
+
def subset_without_input_none(predictions):
|
|
63
63
|
# remove None entries
|
|
64
64
|
return [p for p in predictions if p["input_mol"] is not None]
|
|
65
|
+
|
|
66
|
+
@when(
|
|
67
|
+
"the subset of the result where the preprocessed mol was not None is considered",
|
|
68
|
+
target_fixture="subset",
|
|
69
|
+
)
|
|
70
|
+
def subset_without_preprocessed_none(predictions):
|
|
71
|
+
# remove None entries
|
|
72
|
+
return [p for p in predictions if p["preprocessed_mol"] is not None]
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
from .converter import Converter
|
|
4
|
-
from .converter_config import ALL, ConverterConfig
|
|
5
|
-
|
|
6
|
-
__all__ = ["BasicTypeConverter", "basic_data_types"]
|
|
7
|
-
|
|
8
|
-
basic_data_types = [
|
|
9
|
-
"int",
|
|
10
|
-
"float",
|
|
11
|
-
"string",
|
|
12
|
-
"bool",
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class BasicTypeConverter(Converter):
|
|
17
|
-
def _convert(self, input: Any, context: dict) -> Any:
|
|
18
|
-
return input
|
|
19
|
-
|
|
20
|
-
config = ConverterConfig(
|
|
21
|
-
data_types=basic_data_types,
|
|
22
|
-
output_formats=ALL,
|
|
23
|
-
)
|
|
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
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/config/search_yaml_configuration.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/problem_list_converter.py
RENAMED
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/representation_converter.py
RENAMED
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/converters/source_list_converter.py
RENAMED
|
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
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/model/convert_representations_step.py
RENAMED
|
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
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/check_valid_smiles.py
RENAMED
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/chembl_structure_pipeline.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/preprocessing_step.py
RENAMED
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/remove_small_fragments.py
RENAMED
|
File without changes
|
{nerdd_module-0.3.40 → nerdd_module-0.3.42}/nerdd_module/preprocessing/remove_stereochemistry.py
RENAMED
|
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
|