From c5f05095a0d97d19372f2b9a353e66a3951878fe Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 14 Jun 2024 10:37:26 +0100 Subject: [PATCH] edit validators.url import --- cmem_plugin_pyshacl/plugin_pyshacl.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmem_plugin_pyshacl/plugin_pyshacl.py b/cmem_plugin_pyshacl/plugin_pyshacl.py index c1a4ac5..b393a07 100644 --- a/cmem_plugin_pyshacl/plugin_pyshacl.py +++ b/cmem_plugin_pyshacl/plugin_pyshacl.py @@ -6,6 +6,7 @@ from time import time from uuid import uuid4 +import validators.url from cmem.cmempy.dp.proxy.graph import get, post_streamed from cmem_plugin_base.dataintegration.context import ExecutionContext from cmem_plugin_base.dataintegration.description import Icon, Plugin, PluginParameter @@ -43,7 +44,6 @@ ) from rdflib.term import Node from strtobool import strtobool -from validators import url as validator_url SKOSXL = Namespace("http://www.w3.org/2008/05/skos-xl#") DATA_GRAPH_TYPES = [ @@ -562,14 +562,14 @@ def check_parameters( # noqa: C901 PLR0912 raise ValueError( "Generate validation graph or Output values parameter " "needs to be set to true" ) - if not validator_url(self.data_graph_uri): + if not validators.url(self.data_graph_uri): raise ValueError("Data graph URI parameter is invalid") - if not validator_url(self.shacl_graph_uri): + if not validators.url(self.shacl_graph_uri): raise ValueError("SHACL graph URI parameter is invalid") graphs_dict = {graph["iri"]: graph["assignedClasses"] for graph in get_graphs_list()} if self.ontology_graph_uri: - if not validator_url(self.ontology_graph_uri): + if not validators.url(self.ontology_graph_uri): raise ValueError("Ontology graph URI parameter is invalid") if self.ontology_graph_uri not in graphs_dict: raise ValueError(f"Ontology graph <{self.ontology_graph_uri}> not found") @@ -593,7 +593,7 @@ def check_parameters( # noqa: C901 PLR0912 except ValueError as err: raise ValueError(f"Invalid truth value for parameter {param}") from err if self.generate_graph: - if not validator_url(self.validation_graph_uri): + if not validators.url(self.validation_graph_uri): raise ValueError("Validation graph URI parameter is invalid") if self.validation_graph_uri in graphs_dict: self.log.warning(f"Graph <{self.validation_graph_uri}> already exists")