#NEWLINE# def snapshot( self , nodeMetaDict = None , connectionMetaDict = None , variableMetaList = None ) : #NEWLINE# #INDENT# "\n        Creates a 'snapshot' dictionary from the current DAG.\n        " #NEWLINE# nodes = list ( ) #NEWLINE# for dagNode in self . nodes ( ) : #NEWLINE# #INDENT# nodes . append ( { #NEWLINE# #INDENT# 'NAME' : copy . deepcopy ( dagNode . name ) , #NEWLINE# 'TYPE' : type ( dagNode ) . __name__ , #NEWLINE# 'UUID' : str ( dagNode . uuid ) , #NEWLINE# 'STALE' : str ( self . staleNodeDict [ dagNode ] ) , #NEWLINE# 'INPUTS' : [ { #NEWLINE# #INDENT# 'NAME' : copy . deepcopy ( x . name ) , #NEWLINE# 'VALUE' : copy . deepcopy ( x . value ) , #NEWLINE# 'RANGE' : copy . deepcopy ( x . seqRange ) , #NEWLINE# #UNINDENT# } for x in dagNode . inputs ( ) ] , #NEWLINE# 'OUTPUTS' : [ { #NEWLINE# #INDENT# 'NAME' : copy . deepcopy ( x . name ) , #NEWLINE# 'VALUE' : copy . deepcopy ( x . value ) , #NEWLINE# 'RANGE' : copy . deepcopy ( x . seqRange ) , #NEWLINE# #UNINDENT# } for x in dagNode . outputs ( ) ] , #NEWLINE# 'ATTRIBUTES' : [ { #NEWLINE# #INDENT# 'NAME' : copy . deepcopy ( x . name ) , #NEWLINE# 'VALUE' : copy . deepcopy ( x . value ) , #NEWLINE# 'RANGE' : copy . deepcopy ( x . seqRange ) , #NEWLINE# #UNINDENT# } for x in dagNode . attributes ( ) ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# edges = list ( ) #NEWLINE# for connection in sorted ( self . network . edges ( ) ) : #NEWLINE# #INDENT# edges . append ( { #NEWLINE# #INDENT# 'FROM' : str ( connection [ 1 ] . uuid ) , #NEWLINE# 'TO' : str ( connection [ 0 ] . uuid ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# groups = list ( ) #NEWLINE# for key in self . nodeGroupDict : #NEWLINE# #INDENT# groups . append ( { #NEWLINE# #INDENT# 'NAME' : copy . deepcopy ( key ) , #NEWLINE# 'NODES' : [ str ( x . uuid ) for x in self . nodeGroupDict [ key ] ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# snapshotDict = { #NEWLINE# #INDENT# 'CONNECTION_META' : connectionMetaDict , #NEWLINE# 'EDGES' : edges , #NEWLINE# 'NODES' : nodes , #NEWLINE# 'GROUPS' : groups , #NEWLINE# 'NODE_META' : nodeMetaDict , #NEWLINE# 'VARIABLE_SUBSTITIONS' : variableMetaList , #NEWLINE# #UNINDENT# } #NEWLINE# return snapshotDict