mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2024-11-29 11:51:14 +00:00
Changed save_session to serialize_session
This commit is contained in:
parent
cb9f592762
commit
ce66a0c8b0
@ -553,7 +553,7 @@ class DefaultSegment:
|
|||||||
r = r.get_indexed[other.order]
|
r = r.get_indexed[other.order]
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def save_session(self, mdict):
|
def serialize_session(self, mdict):
|
||||||
"""Save extra metadata to a dict so that it can be serialized
|
"""Save extra metadata to a dict so that it can be serialized
|
||||||
|
|
||||||
This is not saved by __getstate__ because child segments will point to
|
This is not saved by __getstate__ because child segments will point to
|
||||||
|
@ -47,15 +47,15 @@ class TestSegment:
|
|||||||
s.set_user_data([r], 4, 99)
|
s.set_user_data([r], 4, 99)
|
||||||
|
|
||||||
out = dict()
|
out = dict()
|
||||||
s.serialize_extra_to_dict(out)
|
s.serialize_session(out)
|
||||||
print("saved", out)
|
print("saved", out)
|
||||||
|
|
||||||
data = np.ones([4000], dtype=np.uint8)
|
data = np.ones([4000], dtype=np.uint8)
|
||||||
r = SegmentData(data)
|
r = SegmentData(data)
|
||||||
s2 = DefaultSegment(r, 0)
|
s2 = DefaultSegment(r, 0)
|
||||||
s2.restore_extra_from_dict(out)
|
s2.restore_session(out)
|
||||||
out2 = dict()
|
out2 = dict()
|
||||||
s2.serialize_extra_to_dict(out2)
|
s2.serialize_session(out2)
|
||||||
print("loaded", out2)
|
print("loaded", out2)
|
||||||
assert out == out2
|
assert out == out2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user