Fix string formatting in private object representation
authorLisa Velden <velden@google.com>
Mon, 20 Apr 2015 09:42:47 +0000 (11:42 +0200)
committerPetr Pudlak <pudlak@google.com>
Mon, 20 Apr 2015 09:45:57 +0000 (11:45 +0200)
and use one-element tuplesfor string formatting

Signed-off-by: Lisa Velden <velden@google.com>
Signed-off-by: Petr Pudlak <pudlak@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>

lib/serializer.py

index c63577b..38fe841 100644 (file)
@@ -253,10 +253,10 @@ class Private(object):
     return self._item
 
   def __str__(self):
-    return "<%s>" % self._descr
+    return "<%s>" % (self._descr, )
 
   def __repr__(self):
-    return "Private(?, descr=%r)".format(self._descr)
+    return "Private(?, descr=%r)" % (self._descr, )
 
   # pylint: disable=W0212
   # If it doesn't access _item directly, the call will go through __getattr__
@@ -280,7 +280,7 @@ class Private(object):
 
   def __call__(self, *args, **kwargs):
     return Private(self._item(*args, **kwargs),
-                   descr="%s()" % self._descr)
+                   descr="%s()" % (self._descr, ))
 
   # pylint: disable=R0201
   # While this could get away with being a function, it needs to be a method.