From afb16b1a4208398dd734f93098f8d47f0be32b76 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Fri, 10 Nov 2023 12:36:25 +0100 Subject: [PATCH] fix(xmlupload): fix non-initialized variable (DEV-2922) (#629) --- src/dsp_tools/utils/xmlupload/xmlupload.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dsp_tools/utils/xmlupload/xmlupload.py b/src/dsp_tools/utils/xmlupload/xmlupload.py index 435c2faf8..a78c72cfe 100644 --- a/src/dsp_tools/utils/xmlupload/xmlupload.py +++ b/src/dsp_tools/utils/xmlupload/xmlupload.py @@ -157,6 +157,7 @@ def _upload( ) -> tuple[IriResolver, list[str]]: # upload all resources, then update the resources with the stashed XML texts and resptrs failed_uploads: list[str] = [] + iri_resolver = IriResolver() try: iri_resolver, failed_uploads = _upload_resources( resources=resources, @@ -167,6 +168,7 @@ def _upload( config=config, project_client=project_client, list_client=list_client, + id_to_iri_resolver=iri_resolver, ) nonapplied_stash = ( _upload_stash( @@ -283,6 +285,7 @@ def _upload_resources( config: UploadConfig, project_client: ProjectClient, list_client: ListClient, + id_to_iri_resolver: IriResolver, ) -> tuple[IriResolver, list[str]]: """ Iterates through all resources and tries to upload them to DSP. @@ -298,6 +301,7 @@ def _upload_resources( config: the upload configuration project_client: a client for HTTP communication with the DSP-API list_client: a client for HTTP communication with the DSP-API + id_to_iri_resolver: a resolver for internal IDs to IRIs Returns: id2iri_mapping, failed_uploads @@ -308,8 +312,6 @@ def _upload_resources( json_ld_context = get_json_ld_context_for_project(project_client.get_ontology_name_dict()) listnode_lookup = list_client.get_list_node_id_to_iri_lookup() - id_to_iri_resolver = IriResolver() - resource_create_client = ResourceCreateClient( con=con, project_iri=project_iri,