#NEWLINE# def asString( self , strict = False ) : #NEWLINE# #INDENT# "\n        Return the location as a string.\n        ::\n        \n            >>> l = Location(pop=1, snap=(-100.0, -200))\n            >>> l.asString()\n            'pop:1, snap:(-100.000,-200.000)'\n        " #NEWLINE# if ( len ( self . keys ( ) ) == 0 ) : #NEWLINE# #INDENT# return 'origin' #NEWLINE# #UNINDENT# v = [ ] #NEWLINE# n = [ ] #NEWLINE# try : #NEWLINE# #INDENT# for ( name , value ) in self . asTuple ( ) : #NEWLINE# #INDENT# s = '' #NEWLINE# if ( value is None ) : #NEWLINE# #INDENT# s = 'None' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( type ( name ) == tuple ) or ( type ( value ) == list ) ) : #NEWLINE# #INDENT# s = ( '(%.3f,%.3f)' % ( value [ 0 ] , value [ 1 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( int ( value ) == value ) : #NEWLINE# #INDENT# s = ( '%d' % int ( value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# s = ( '%.3f' % value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if ( s != '' ) : #NEWLINE# #INDENT# n . append ( ( '%s:%s' % ( name , s ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ', ' . join ( n ) #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# import traceback #NEWLINE# print ( 'Location value error:' , name , value ) #NEWLINE# for ( key , value ) in self . items ( ) : #NEWLINE# #INDENT# print ( '\t\tkey:' , key ) #NEWLINE# print ( '\t\tvalue:' , value ) #NEWLINE# #UNINDENT# traceback . print_exc ( ) #NEWLINE# return 'error'