From 050ee3b7c8ec192f5b9efd8a9a4da3c5db399b9d Mon Sep 17 00:00:00 2001 From: Jake Fennick Date: Mon, 27 May 2024 14:00:50 -1000 Subject: [PATCH] make a copy of Namespace manually (rather than using deepcopy) --- src/prov/model.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/prov/model.py b/src/prov/model.py index 709a196..5df3b60 100644 --- a/src/prov/model.py +++ b/src/prov/model.py @@ -7,7 +7,6 @@ PROV-JSON: https://openprovenance.org/prov-json/ """ from collections import defaultdict -from copy import deepcopy import datetime import io import itertools @@ -1177,9 +1176,8 @@ def valid_qualified_name(self, qname): # reuse the existing namespace new_qname = existing_ns[local_part] else: - # Do not reuse the namespace object - namespace._cache = dict() # Do not deepcopy the cache! - ns = self.add_namespace(deepcopy(namespace)) + # Do not reuse the namespace object, making an identical copy + ns = self.add_namespace(Namespace(namespace.prefix, namespace.uri)) # minting the same Qualified Name from the namespace's copy new_qname = ns[qname.localpart] # returning the new qname