Skip to content

Commit

Permalink
validate many is None for run_many usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssarah committed Aug 16, 2024
1 parent ff9284b commit 41c7fcf
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions kgforge/specializations/models/demo_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,15 @@ def _validate_one(self, resource: Resource, type_: str, inference: str) -> None:
If the resource is not typed, AttributeError is raised
"""
type_expanded = self.service.expand(type_)

schema = self.service.schema(type_expanded)
result, reason = self.service.check(resource, schema)
if reason is not None:
raise ValidationError(reason)

_validate_many = None


# Utils.

@staticmethod
Expand All @@ -124,13 +128,6 @@ def _generate_context(self) -> Dict:
def schema_id(self, type: str) -> str:
raise not_supported()

def _validate_many(
self, resources: List[Resource], type_: str, inference: str
) -> None:

for resource in resources:
self._validate_one(resource, type_, inference)


class ModelLibrary:
"""Simulate a third-party library handling interactions with the data used by the model."""
Expand Down

0 comments on commit 41c7fcf

Please sign in to comment.