Skip to content

Commit

Permalink
saving documents with the representation
Browse files Browse the repository at this point in the history
  • Loading branch information
prismofeverything committed Sep 26, 2024
1 parent 1ee77ab commit 2a7c256
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions process_bigraph/composite.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,21 +605,31 @@ def __init__(self, config=None, core=None):
# self.run_steps(self.to_run)

def save(self,
filename='one_cell_two_directions.json',
filename='composite.json',
outdir='out',
include_schema=False):
schema=False,
state=False):

serialized_state = self.core.serialize(
self.composition,
self.state)
document = {}

if not schema and not state:
schema = state = True

if state:
serialized_state = self.core.serialize(
self.composition,
self.state)

document['state'] = serialized_state

document = {
'state': serialized_state}
if schema:
# serialized_schema = self.core.serialize(
# 'schema',
# self.composition)

if include_schema:
serialized_schema = self.core.serialize(
'schema',
serialized_schema = self.core.representation(
self.composition)

document['composition'] = serialized_schema

# TODO: make this true
Expand All @@ -629,6 +639,7 @@ def save(self,
# assert copy_composite == self

# save the dictionary to a JSON file

if not os.path.exists(outdir):
os.makedirs(outdir)
filename = os.path.join(outdir, filename)
Expand Down

0 comments on commit 2a7c256

Please sign in to comment.