Added Price info
This commit is contained in:
@@ -3,4 +3,4 @@
|
||||
import tHome as T
|
||||
|
||||
d = T.config.parse( "/home/ted/proj/tHome/conf" )
|
||||
print d
|
||||
print(d)
|
||||
|
||||
@@ -11,7 +11,7 @@ class Data:
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
def keys( self ):
|
||||
return self.__dict__.keys()
|
||||
return list(self.__dict__.keys())
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
def update( self, rhs ):
|
||||
@@ -43,7 +43,7 @@ class Data:
|
||||
def _formatValue( self, value, out, indent ):
|
||||
if isinstance( value, Data ):
|
||||
out.write( "%s(\n" % self.__class__.__name__ )
|
||||
for k, v in sorted( value.__dict__.iteritems() ):
|
||||
for k, v in sorted( value.__dict__.items() ):
|
||||
if k[0] == "_":
|
||||
continue
|
||||
|
||||
@@ -56,7 +56,7 @@ class Data:
|
||||
|
||||
elif isinstance( value, dict ):
|
||||
out.write( "{\n" )
|
||||
for k, v in sorted( value.iteritems() ):
|
||||
for k, v in sorted( value.items() ):
|
||||
if k[0] == "_":
|
||||
continue
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def loads( text ):
|
||||
#=============================================================================
|
||||
def _toStr( data, ignoreDicts=False ):
|
||||
# Convert unicode to string.
|
||||
if isinstance( data, unicode ):
|
||||
if isinstance( data, str ):
|
||||
return data.encode( 'utf-8' )
|
||||
|
||||
# For lists, process each item.
|
||||
@@ -45,7 +45,7 @@ def _toStr( data, ignoreDicts=False ):
|
||||
if isinstance( data, dict ) and not ignoreDicts:
|
||||
return {
|
||||
_toStr( k, ignoreDicts=True ) : _toStr( v, ignoreDicts=True )
|
||||
for k, v in data.iteritems()
|
||||
for k, v in data.items()
|
||||
}
|
||||
|
||||
# Otherwise return the original object.
|
||||
|
||||
@@ -138,7 +138,7 @@ class Poll:
|
||||
# themselves. So make a copy of the dict value list list
|
||||
# containing all the objects so we're not modifying the client
|
||||
# dictionary as we loop over it.
|
||||
clients = self.clients.values()[:]
|
||||
clients = list(self.clients.values())[:]
|
||||
for c in clients:
|
||||
c.close()
|
||||
|
||||
@@ -169,7 +169,7 @@ class Poll:
|
||||
# Returns tuple (fileDescriptor, bitFlag) of the files
|
||||
# that can act.
|
||||
events = self.poll.poll( timeOut_msec )
|
||||
except select.error, v:
|
||||
except select.error as v:
|
||||
# Not sure why, but sometimes with a timeout value, you can
|
||||
# get an "interrupted system call" error thrown. Web
|
||||
# searches indicate this isn't really an error and should be
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
from tHome.util import Data
|
||||
|
||||
d = Data( a=1, b="asdf", c=2 )
|
||||
print d
|
||||
print "----"
|
||||
print(d)
|
||||
print("----")
|
||||
|
||||
d = Data( a=1, b="asdf", c=[2,3,4] )
|
||||
print d
|
||||
print "----"
|
||||
print(d)
|
||||
print("----")
|
||||
|
||||
d = Data( a=1, b="asdf", c={'a':3, 'b':4} )
|
||||
print d
|
||||
print "----"
|
||||
print(d)
|
||||
print("----")
|
||||
|
||||
d = Data( a=1, b=[ Data(a=1,b=2) ], c={'a':3, 'b':[1,2,3]} )
|
||||
print d
|
||||
print "----"
|
||||
print(d)
|
||||
print("----")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user