From 6b8b95221185f9ae3fd436b7fcb876698198fd14 Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Mon, 24 Aug 2015 17:49:34 +0100
Subject: [PATCH] Remove or comment out print statements.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/frontends/magic_folder.py | 20 ++++++--------------
 src/allmydata/test/test_magic_folder.py | 23 +++++++++++------------
 2 files changed, 17 insertions(+), 26 deletions(-)

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index 3f4bf834..e6cf18c1 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -74,18 +74,14 @@ class MagicFolder(service.MultiService):
         self.is_ready = True
         d = self.uploader.start_scanning()
         d2 = self.downloader.start_scanning()
-        d.addCallback(lambda x: d2)
+        d.addCallback(lambda ign: d2)
         return d
 
     def finish(self):
-        print "finish"
+        #print "finish"
         d = self.uploader.stop()
-        def _print(f):
-            print f
-            return f
-        d.addErrback(_print)
-        d.addBoth(lambda ign: self.downloader.stop())
-        d.addErrback(_print)
+        d2 = self.downloader.stop()
+        d.addCallback(lambda ign: d2)
         return d
 
     def remove_service(self):
@@ -124,7 +120,7 @@ class QueueMixin(HookMixin):
     def _log(self, msg):
         s = "Magic Folder %s: %s" % (self._name, msg)
         self._client.log(s)
-        print s
+        #print s
         #open("events", "ab+").write(msg)
 
     def _append_to_deque(self, path):
@@ -470,7 +466,7 @@ class Downloader(QueueMixin):
                 file_node, metadata = listing_map[name]
                 local_version = self._get_local_latest(name)
                 remote_version = metadata.get('version', None)
-                print "%r has local version %r, remote version %r" % (name, local_version, remote_version)
+                #print "%r has local version %r, remote version %r" % (name, local_version, remote_version)
                 if local_version is None or remote_version is None or local_version < remote_version:
                     self._append_to_batch(name, file_node, metadata)
 
@@ -496,10 +492,6 @@ class Downloader(QueueMixin):
             return d
         collective_dirmap_d.addCallback(scan_collective)
         collective_dirmap_d.addCallback(self._filter_scan_batch)
-        def _print(f):
-            print f
-            return f
-        collective_dirmap_d.addErrback(_print)
         collective_dirmap_d.addCallback(self._add_batch_to_download_queue)
         return collective_dirmap_d
 
diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py
index 7d39ed85..a0a62a41 100644
--- a/src/allmydata/test/test_magic_folder.py
+++ b/src/allmydata/test/test_magic_folder.py
@@ -208,15 +208,15 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.objects_queued'), 0))
 
         def restart(ignore):
-            print "restart"
+            #print "restart"
             tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg")
             tahoe_config = fileutil.read(tahoe_config_file)
             d3 = defer.succeed(None)
             def write_config(client_node_dir):
-                print "write_config"
+                #print "write_config"
                 fileutil.write(os.path.join(client_node_dir, "tahoe.cfg"), tahoe_config)
             def setup_stats(result):
-                print "setup_stats"
+                #print "setup_stats"
                 self.client = None
                 self.set_up_grid(client_config_hooks={0: write_config})
                 self.client = self.g.clients[0]
@@ -315,7 +315,7 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
 
     def _check_version_in_local_db(self, magicfolder, relpath_u, expected_version):
         version = magicfolder._db.get_local_file_version(relpath_u)
-        print "_check_version_in_local_db %r %s---------------------------------" % (relpath_u, version)
+        #print "_check_version_in_local_db: %r has version %s" % (relpath_u, version)
         self.failUnlessEqual(version, expected_version)
 
     def test_alice_bob(self):
@@ -324,13 +324,12 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
             # XXX are these used?
             (self.alice_collective_dircap, self.alice_upload_dircap, self.alice_magicfolder,
              self.bob_collective_dircap,   self.bob_upload_dircap,   self.bob_magicfolder) = result
-            print "Alice magicfolderdb is at %r" % (self.alice_magicfolder._client.basedir)
-            print "Bob   magicfolderdb is at %r" % (self.bob_magicfolder._client.basedir)
+            #print "Alice magicfolderdb is at %r" % (self.alice_magicfolder._client.basedir)
+            #print "Bob   magicfolderdb is at %r" % (self.bob_magicfolder._client.basedir)
         d.addCallback(get_results)
 
         def Alice_write_a_file(result):
-            print "Alice writes a file\n"
-            # XXX simplify by just using FilePath and setContent
+            #print "Alice writes a file\n"
             self.file_path = abspath_expanduser_unicode(u"file1", base=self.alice_magicfolder.uploader._local_path_u)
             fileutil.write(self.file_path, "meow, meow meow. meow? meow meow! meow.")
             self.magicfolder = self.alice_magicfolder
@@ -339,7 +338,7 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
         d.addCallback(Alice_write_a_file)
 
         def Alice_wait_for_upload(result):
-            print "Alice waits for an upload\n"
+            #print "Alice waits for an upload\n"
             d2 = self.alice_magicfolder.uploader.set_hook('processed')
             return d2
         d.addCallback(Alice_wait_for_upload)
@@ -352,7 +351,7 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('uploader.directories_created', client=self.alice_magicfolder._client), 0))
 
         def Bob_wait_for_download(result):
-            print "Bob waits for a download\n"
+            #print "Bob waits for a download\n"
             d2 = self.bob_magicfolder.downloader.set_hook('processed')
             return d2
         d.addCallback(Bob_wait_for_download)
@@ -363,7 +362,7 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
 
         # test deletion of file behavior
         def Alice_delete_file(result):
-            print "Alice deletes the file!\n"
+            #print "Alice deletes the file!\n"
             os.unlink(self.file_path)
             self.notify(to_filepath(self.file_path), self.inotify.IN_DELETE)
 
@@ -381,7 +380,7 @@ class MagicFolderTestMixin(MagicFolderTestMixin, ShouldFailMixin, ReallyEqualMix
 
 
         def Alice_rewrite_file(result):
-            print "Alice rewrites file\n"
+            #print "Alice rewrites file\n"
             self.file_path = abspath_expanduser_unicode(u"file1", base=self.alice_magicfolder.uploader._local_path_u)
             fileutil.write(self.file_path, "Alice suddenly sees the white rabbit running into the forest.")
             self.magicfolder = self.alice_magicfolder
-- 
2.45.2