#NEWLINE# def to_dict( self ) : #NEWLINE# #INDENT# ' to_dict (self)\n\n            Creates a representation of the class as a dictionary\n            Overrides the parent method as all members variables of\n            this class are strings\n\n        ' #NEWLINE# data = [ ] #NEWLINE# attributes = [ attr for attr in dir ( self ) if ( ( not callable ( getattr ( self , attr ) ) ) and ( not attr . startswith ( '__' ) ) ) ] #NEWLINE# for attr in attributes : #NEWLINE# #INDENT# if ( attr == 'output' ) : #NEWLINE# #INDENT# output = getattr ( self , attr ) #NEWLINE# if ( type ( output ) == list ) : #NEWLINE# #INDENT# for port in output : #NEWLINE# #INDENT# tmp = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# tmp [ attr . __str__ ( ) ] = port #NEWLINE# data . append ( tmp ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if output : #NEWLINE# #INDENT# tmp = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# tmp [ attr . __str__ ( ) ] = getattr ( self , attr ) #NEWLINE# data . append ( tmp ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if getattr ( self , attr ) : #NEWLINE# #INDENT# tmp = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# tmp [ attr . __str__ ( ) ] = getattr ( self , attr ) #NEWLINE# data . insert ( 0 , tmp ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return data