From 41c7fcf0df0d1fcbf6f6e3b83ca82278bcb1d654 Mon Sep 17 00:00:00 2001 From: mouffok Date: Fri, 16 Aug 2024 11:12:36 +0200 Subject: [PATCH] validate many is None for run_many usage --- kgforge/specializations/models/demo_model.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/kgforge/specializations/models/demo_model.py b/kgforge/specializations/models/demo_model.py index f5a84b75..2e638a94 100644 --- a/kgforge/specializations/models/demo_model.py +++ b/kgforge/specializations/models/demo_model.py @@ -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 @@ -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."""