]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Avoid .format, since it is inconsistent between Python 2.6 and 2.7 (and the rest...
authorDaira Hopwood <daira@jacaranda.org>
Tue, 27 Oct 2015 01:20:28 +0000 (01:20 +0000)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 28 Dec 2015 16:18:53 +0000 (16:18 +0000)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/frontends/magic_folder.py
src/allmydata/test/check_magicfolder_smoke.py
src/allmydata/test/test_magic_folder.py

index 51750888cdd0b37e1f5a6d2ecabefc4450800bdc..9225d17b3ce01fb6050545d95d6c957335849171 100644 (file)
@@ -325,7 +325,7 @@ class Uploader(QueueMixin):
                 elif self._db.is_new_file(pathinfo, relpath_u):
                     new_version = current_version + 1
                 else:
-                    self._log("Not uploading '{0}'".format(relpath_u))
+                    self._log("Not uploading %r" % (relpath_u,))
                     self._count('objects_not_uploaded')
                     return
 
@@ -373,7 +373,7 @@ class Uploader(QueueMixin):
                 elif self._db.is_new_file(pathinfo, relpath_u):
                     new_version = current_version + 1
                 else:
-                    self._log("Not uploading '{0}'".format(relpath_u))
+                    self._log("Not uploading %r" % (relpath_u,))
                     self._count('objects_not_uploaded')
                     return None
 
@@ -628,7 +628,7 @@ class Downloader(QueueMixin, WriteFileMixin):
             if self._should_download(relpath_u, metadata['version']):
                 extension += [(relpath_u, file_node, metadata)]
             else:
-                self._log("Excluding '{0}'".format(relpath_u))
+                self._log("Excluding %r" % (relpath_u,))
                 self._count('objects_excluded')
                 self._call_hook(None, 'processed')
         return extension
index e3b2013d93ff3f6d526c8030cba50832df3dfdd3..b34eebdfcb63ca510d813f5d8089a3b09e67003b 100644 (file)
@@ -48,7 +48,7 @@ if not exists(data_base):
     mkdir(data_base)
 
 if not exists(tahoe_bin):
-    raise RuntimeError("Can't find 'tahoe' binary at '{}'".format(tahoe_bin))
+    raise RuntimeError("Can't find 'tahoe' binary at %r" % (tahoe_bin,))
 
 if 'kill' in sys.argv:
     print("Killing the grid")
@@ -92,7 +92,7 @@ for x in range(5):
         subprocess.check_call(
             [
                 tahoe_bin, 'create-node',
-                '--nickname', 'node{}'.format(x),
+                '--nickname', 'node%d' % (x,),
                 '--introducer', furl,
                 data_dir,
             ]
@@ -100,18 +100,18 @@ for x in range(5):
         with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
             f.write('''
 [node]
-nickname = node{node_id}
+nickname = node%(node_id)s
 web.port =
 web.static = public_html
-tub.location = localhost:{tub_port}
+tub.location = localhost:%(tub_port)d
 
 [client]
 # Which services should this client connect to?
-introducer.furl = {furl}
+introducer.furl = %(furl)s
 shares.needed = 2
 shares.happy = 3
 shares.total = 4
-'''.format(node_id=x, furl=furl, tub_port=(9900 + x)))
+''' % {'node_id':x, 'furl':furl, 'tub_port':(9900 + x)})
     subprocess.check_call(
         [
             tahoe_bin, 'start', data_dir,
@@ -125,7 +125,7 @@ do_invites = False
 node_id = 0
 for name in ['alice', 'bob']:
     data_dir = join(data_base, name)
-    magic_dir = join(data_base, '{}-magic'.format(name))
+    magic_dir = join(data_base, '%s-magic' % (name,))
     mkdir(magic_dir)
     if not exists(data_dir):
         do_invites = True
@@ -141,17 +141,17 @@ for name in ['alice', 'bob']:
         with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
             f.write('''
 [node]
-nickname = {name}
-web.port = tcp:998{node_id}:interface=localhost
+nickname = %(name)s
+web.port = tcp:998%(node_id)d:interface=localhost
 web.static = public_html
 
 [client]
 # Which services should this client connect to?
-introducer.furl = {furl}
+introducer.furl = %(furl)s
 shares.needed = 2
 shares.happy = 3
 shares.total = 4
-'''.format(name=name, node_id=node_id, furl=furl, magic_dir=magic_dir))
+''' % {'name':name, 'node_id':node_id, 'furl':furl})
     subprocess.check_call(
         [
             tahoe_bin, 'start', data_dir,
@@ -206,7 +206,7 @@ if do_invites:
 if True:
     for name in ['alice', 'bob']:
         with open(join(data_base, name, 'private', 'magic_folder_dircap'), 'r') as f:
-            print("dircap {}: {}".format(name, f.read().strip()))
+            print("dircap %s: %s" % (name, f.read().strip()))
 
 # give storage nodes a chance to connect properly? I'm not entirely
 # sure what's up here, but I get "UnrecoverableFileError" on the
@@ -354,7 +354,7 @@ if True:
                 print("  file contents still mismatched: %d bytes:\n" % (len(content),))
                 print(content)
         else:
-            print("   {} not there yet".format(alice_foo))
+            print("   %r not there yet" % (alice_foo,))
         time.sleep(1)
 
 # XXX test .backup (delete a file)
index 081e24cb7f7d0c0548875afe07d78ddc18356503..2d60a93efd97285b8a9a706a537195bd546aa6cb 100644 (file)
@@ -270,7 +270,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
 
             # ensure we still have a DB entry, and that the version is 1
             node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
-            self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+            self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
             self.failUnlessEqual(metadata['version'], 1)
 
         finally:
@@ -305,7 +305,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
 
             # ensure we still have a DB entry, and that the version is 1
             node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
-            self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+            self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
             self.failUnlessEqual(metadata['version'], 1)
 
             # restore the file, with different contents
@@ -318,7 +318,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
 
             # ensure we still have a DB entry, and that the version is 2
             node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
-            self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
+            self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
             self.failUnlessEqual(metadata['version'], 2)
 
         finally: