Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(xmlupload): fix non-initialized variable (DEV-2922) #629

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/dsp_tools/utils/xmlupload/xmlupload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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,
Expand Down