When Cells and Spaces are deleted, Their interfaces _impl point to the NullImpl object.
When a reference refers to deleted Cells and Spaces, These objects are pickled when the model is serialized.
Here is a sample script to reproduce the phenomenon.
import modelx as mx
@mx.defcells
def foo():
return 1
mx.Model1.Space1.bar = foo
del mx.Model1.Space1.foo
mx.Model1.write('Ref2Deleted')
The resulting file Ref2Deleted/Space1/.__init__.py looks like below
# modelx: pseudo-python
# This file is part of a modelx model.
# It can be imported as a Python module, but functions defined herein
# are model formulas and may not be executable as standard Python.
from modelx.serialize.jsonvalues import *
_formula = None
_bases = []
_allow_none = None
_spaces = []
# ---------------------------------------------------------------------------
# References
bar = ("Pickle", 2229981096848)
Saving the null object as binary is not transparent, so I want to have it serialized literally in the touple representing the ref's value.
When Cells and Spaces are deleted, Their interfaces
_implpoint to the NullImpl object.When a reference refers to deleted Cells and Spaces, These objects are pickled when the model is serialized.
Here is a sample script to reproduce the phenomenon.
The resulting file
Ref2Deleted/Space1/.__init__.pylooks like belowSaving the null object as binary is not transparent, so I want to have it serialized literally in the touple representing the ref's value.