Skip to content

Commit

Permalink
make a copy of Namespace manually (rather than using deepcopy)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfennick committed May 28, 2024
1 parent 1ff4966 commit 050ee3b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/prov/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 050ee3b

Please sign in to comment.