generated from pyiron/pyiron_module_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I currently have snippets like this running around:
if (
len(validation["missing_triples"]) > 0
or len(validation["incompatible_connections"]) > 0
or len(validation["distinct_units"]) > 0
):Or, less egregiously, annoying string references like
self.assertEqual(validate_values(graph)["incompatible_connections"], [])Also, since #255, they type return on ontology.validate_values is extremely vague:
semantikon/semantikon/ontology.py
Line 329 in e173ae1
| ) -> dict[str, Any]: |
Let's make a new dataclass to hold the validation like
@dataclass
class Validation:
missing_triples: list
incompatible_connections: list
distinct_units: dict[URIRef, list[URIRef]]
def valid():
return not any([
self.missing_triples,
self.incompatible_connections,
self.distinct_units
]) # We could iterate over fields, but no need to get fancy yet
def report():
return as_dict(self) # Or a JSON or whateverActually, that's basically it, but I want to make sure @samwaseda doesn't hate it before I bother writing tests and adapting all the existing tests.
samwaseda
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request