]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
various pyflakes fixes
authorDavid Stainton <dstainton415@gmail.com>
Wed, 8 Jul 2015 17:09:15 +0000 (10:09 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 16:56:01 +0000 (17:56 +0100)
src/allmydata/client.py
src/allmydata/frontends/magic_folder.py
src/allmydata/scripts/magic_folder_cli.py
src/allmydata/test/test_cli_magic_folder.py
src/allmydata/test/test_magic_folder.py

index dd5f8be98fea8577c28593763c78e8c3289ee669..cd43ff834161bbfbe054980fd9b6eca3fa391763 100644 (file)
@@ -14,7 +14,7 @@ from allmydata.immutable.upload import Uploader
 from allmydata.immutable.offloaded import Helper
 from allmydata.control import ControlServer
 from allmydata.introducer.client import IntroducerClient
-from allmydata.util import fileutil, hashutil, base32, pollmixin, log, keyutil, idlib
+from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
 from allmydata.util.encodingutil import get_filesystem_encoding, \
      from_utf8_or_none
 from allmydata.util.fileutil import abspath_expanduser_unicode
index f7373f24f41fd1a6ef9faa0d4cc80354626564c4..e68580c29f8f9fb06ccb6dd6d3790174f04f9b0d 100644 (file)
@@ -158,8 +158,7 @@ class MagicFolder(service.MultiService):
             d = defer.succeed(None)
             collective_dirmap, others_list = result
             for dir_name in others_list:
-                # XXX this is broken
-                d.addCallback(lambda x: self._scan_remote(dir_name, collective_dirmap[dir_name][0]))
+                d.addCallback(lambda x, dir_name=dir_name: self._scan_remote(dir_name, collective_dirmap[dir_name][0]))
                 collective_dirmap_d.addCallback(self._filter_scan_batch)
                 collective_dirmap_d.addCallback(self._add_batch_to_download_queue)
             return d
@@ -188,7 +187,7 @@ class MagicFolder(service.MultiService):
             self._stats_provider.count('magic_folder.objects_downloaded', +1)
             return None
         def failed(f):
-            return failure.Failure("download failed")
+            return Failure("download failed")
         def remove_from_pending(result):
             self._download_pending = self._download_pending.difference(set([name]))
         d.addCallbacks(succeeded, failed)
@@ -201,7 +200,7 @@ class MagicFolder(service.MultiService):
 
     def _db_file_is_uploaded(self, childpath):
         """_db_file_is_uploaded returns true if the file was previously uploaded
-        """ 
+        """
         assert self._db != None
         r = self._db.check_file(childpath)
         filecap = r.was_uploaded()
@@ -334,7 +333,7 @@ class MagicFolder(service.MultiService):
                 try:
                     metadata_d = self._upload_dirnode.get_metadata_for(name)
                 except KeyError:
-                    return failure.Failure()
+                    return Failure()
                 return metadata_d
 
             if not os.path.exists(path):
index b0cc8a2357b78293aa8df8b66208aa4496789eeb..098bace3c3a13c47b8644a72e921992c490209cd 100644 (file)
@@ -1,14 +1,12 @@
 
 import os, json
 from cStringIO import StringIO
-from twisted.python import usage, failure
+from twisted.python import usage
 
-from allmydata.scripts.common import BaseOptions
 from .common import BaseOptions, BasedirOptions, get_aliases
 from .cli import MakeDirectoryOptions, ListOptions, LnOptions
 import tahoe_ls, tahoe_mv
 from allmydata.util import fileutil
-from allmydata.util.fileutil import abspath_expanduser_unicode
 
 
 INVITE_SEPERATOR = "~"
index 3052719843aa65225aa44a386eb02bcf6f542ddb..c5dc368e67f24d5e88ce0114eaf23e125d3f789a 100644 (file)
@@ -1,5 +1,4 @@
 import os.path
-import urllib
 import re
 import json
 
@@ -8,9 +7,7 @@ from twisted.internet import defer
 
 from allmydata.util import fileutil
 from allmydata.scripts.common import get_aliases
-from allmydata.scripts import cli, runner
 from allmydata.test.no_network import GridTestMixin
-from allmydata.util.encodingutil import quote_output, get_io_encoding
 from .test_cli import CLITestMixin
 from allmydata.scripts import magic_folder_cli
 from allmydata.util.fileutil import abspath_expanduser_unicode
index f33d5f94eac808de64bbd38e01417a283ae8edae..82fa236ab76d3e8cbb1479cd8cbbc4fbdc09d7f2 100644 (file)
@@ -1,10 +1,10 @@
 
-import os, sys, stat, time, json, re
+import os, sys, stat, time
 
 from twisted.trial import unittest
 from twisted.internet import defer
 
-from allmydata.interfaces import IDirectoryNode, NoSuchChildError
+from allmydata.interfaces import IDirectoryNode
 
 from allmydata.util import fake_inotify, fileutil
 from allmydata.util.encodingutil import get_filesystem_encoding, to_filepath
@@ -12,14 +12,12 @@ from allmydata.util.consumer import download_to_data
 from allmydata.test.no_network import GridTestMixin
 from allmydata.test.common_util import ReallyEqualMixin, NonASCIIPathMixin
 from allmydata.test.common import ShouldFailMixin
-from allmydata.test.test_cli import CLITestMixin
 from allmydata.test.test_cli_magic_folder import MagicFolderCLITestMixin
 
 from allmydata.frontends import magic_folder
 from allmydata.frontends.magic_folder import MagicFolder
 from allmydata import backupdb
 from allmydata.util.fileutil import abspath_expanduser_unicode
-from allmydata.util import fileutil
 
 class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqualMixin, NonASCIIPathMixin):
     """
@@ -147,7 +145,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.files_uploaded'), 0))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 1))
-        
+
         def _check_move_small_tree(res):
             self.mkdir_nonascii(small_tree_dir)
             fileutil.write(abspath_expanduser_unicode(u"what", base=small_tree_dir), "say when")
@@ -221,7 +219,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         d.addCallback(create_test_file)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 1))
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
-        
+
         def restart(ignore):
             tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg")
             tahoe_config = fileutil.read(tahoe_config_file)