#NEWLINE# def save( self , fname , iszip = True ) : #NEWLINE# #INDENT# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( k , v ) in self . __dict__ . items ( ) : #NEWLINE# #INDENT# if isinstance ( v , set ) : #NEWLINE# #INDENT# d [ k ] = list ( v ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( v , '__dict__' ) : #NEWLINE# #INDENT# d [ k ] = v . __dict__ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# d [ k ] = v #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( sys . version_info [ 0 ] == 3 ) : #NEWLINE# #INDENT# fname = ( fname + '.3' ) #NEWLINE# #UNINDENT# if ( not iszip ) : #NEWLINE# #INDENT# marshal . dump ( d , open ( fname , 'wb' ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# f = gzip . open ( fname , 'wb' ) #NEWLINE# f . write ( marshal . dumps ( d ) ) #NEWLINE# f . close ( )