From: Daira Hopwood Date: Mon, 14 Sep 2015 19:16:03 +0000 (+0100) Subject: Remove redundant inotify parameters to MagicFolder and Uploader constructors. X-Git-Url: https://git.rkrishnan.org/simplejson/components/-?a=commitdiff_plain;h=af0c367cbf7962b3378542201f4436c78005eb6c;p=tahoe-lafs%2Ftahoe-lafs.git Remove redundant inotify parameters to MagicFolder and Uploader constructors. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index d44aa891..add4ba7a 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -44,7 +44,7 @@ def get_inotify_module(): class MagicFolder(service.MultiService): name = 'magic-folder' - def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, inotify=None, + def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, pending_delay=1.0): precondition_abspath(local_path_u) @@ -61,7 +61,7 @@ class MagicFolder(service.MultiService): self.is_ready = False - self.uploader = Uploader(client, local_path_u, db, upload_dircap, inotify, pending_delay) + self.uploader = Uploader(client, local_path_u, db, upload_dircap, pending_delay) self.downloader = Downloader(client, local_path_u, db, collective_dircap) def startService(self): @@ -152,7 +152,7 @@ class QueueMixin(HookMixin): class Uploader(QueueMixin): - def __init__(self, client, local_path_u, db, upload_dircap, inotify, pending_delay): + def __init__(self, client, local_path_u, db, upload_dircap, pending_delay): QueueMixin.__init__(self, client, local_path_u, db, 'uploader') print "Magic-Folder: Uploader: __init__" @@ -165,7 +165,7 @@ class Uploader(QueueMixin): if self._upload_dirnode.is_unknown() or self._upload_dirnode.is_readonly(): raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.") - self._inotify = inotify or get_inotify_module() + self._inotify = get_inotify_module() self._notifier = self._inotify.INotify() if hasattr(self._notifier, 'set_pending_delay'): diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index 8d1eb894..560c7cb3 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -103,7 +103,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): def init_magicfolder(self, client_num, upload_dircap, collective_dircap, local_magic_dir): dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.get_clientdir(i=client_num)) magicfolder = MagicFolder(self.get_client(client_num), upload_dircap, collective_dircap, local_magic_dir, - dbfile, inotify=self.inotify, pending_delay=0.2) + dbfile, pending_delay=0.2) magicfolder.setServiceParent(self.get_client(client_num)) magicfolder.ready() return magicfolder @@ -112,7 +112,7 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): dbfile = abspath_expanduser_unicode(u"private/magicfolderdb.sqlite", base=self.get_clientdir(i=client_num)) self.collective_dircap, self.upload_dircap = self.get_caps_from_files(client_num) self.magicfolder = MagicFolder(self.get_client(client_num), self.upload_dircap, self.collective_dircap, self.local_dir, - dbfile, inotify=self.inotify, pending_delay=0.2) + dbfile, pending_delay=0.2) self.magicfolder.setServiceParent(self.get_client(client_num)) return self.magicfolder.ready() diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index a885df7b..c46c959b 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -59,7 +59,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual dbfile = abspath_expanduser_unicode(u"magicfolderdb.sqlite", base=self.basedir) print "<>--< dbfile %s" % (dbfile,) self.magicfolder = MagicFolder(self.get_client(), self.upload_dircap, self.collective_dircap, self.local_dir, - dbfile, inotify=self.inotify, pending_delay=0.2) + dbfile, pending_delay=0.2) self.magicfolder.setServiceParent(self.get_client()) self.magicfolder.ready() @@ -431,18 +431,18 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase): readonly_dircap = n.get_readonly_uri() self.shouldFail(AssertionError, 'nonexistent local.directory', 'there is no directory', - MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, upload_dircap, '', doesnotexist, magicfolderdb) self.shouldFail(AssertionError, 'non-directory local.directory', 'is not a directory', - MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, upload_dircap, '', not_a_dir, magicfolderdb) self.shouldFail(AssertionError, 'bad upload.dircap', 'does not refer to a directory', - MagicFolder, client, 'bad', '', errors_dir, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, 'bad', '', errors_dir, magicfolderdb) self.shouldFail(AssertionError, 'non-directory upload.dircap', 'does not refer to a directory', - MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, 'URI:LIT:foo', '', errors_dir, magicfolderdb) self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory', - MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb,) self.shouldFail(AssertionError, 'collective dircap', "The URI in 'private/collective_dircap' is not a readonly cap to a directory.", - MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb, inotify=fake_inotify) + MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb) def _not_implemented(): raise NotImplementedError("blah")