Correction to memoization for xml export.

This commit is contained in:
Patrick Shriwise 2019-03-05 11:08:27 -06:00
parent 4b654c2be0
commit 177f3d1423
3 changed files with 5 additions and 5 deletions

View file

@ -503,7 +503,7 @@ class Cell(IDManagerMixin):
path = "./surface[@id='{}']".format(node.surface.id)
if memo and node.surface.id in memo['surfaces']:
return
if memo:
if memo is not None:
memo['surfaces'].add(node.surface.id)
xml_element.append(node.surface.to_xml_element())

View file

@ -467,7 +467,7 @@ class Lattice(IDManagerMixin, metaclass=ABCMeta):
if memo is None:
memo = {}
# If no nemoize'd clone exists, instantiate one
# If no memoize'd clone exists, instantiate one
if self not in memo:
clone = deepcopy(self)
clone.id = None
@ -760,7 +760,7 @@ class RectLattice(Lattice):
# If the element does contain the Lattice subelement, then return
if memo and self._id in memo['lattices']:
return
if memo:
if memo is not None:
memo['lattices'].add(self._id)
lattice_subelement = ET.Element("lattice")
@ -1282,7 +1282,7 @@ class HexLattice(Lattice):
# If the element does contain the Lattice subelement, then return
if memo and self._id in memo['lattices']:
return
if memo:
if memo is not None:
memo['lattices'].add(self._id)
lattice_subelement = ET.Element("hex_lattice")

View file

@ -519,7 +519,7 @@ class Universe(IDManagerMixin):
# If the cell was not already written, write it
if memo and cell_id in memo['cells']:
continue
if memo:
if memo is not None:
memo['cells'].add(cell_id)
# Create XML subelement for this Cell