From bbed52203389e03abe57077a86e650788230eb17 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Mon, 8 Aug 2011 17:11:17 -0700 Subject: [PATCH] Remove all trailing whitespace from .py files. --- src/allmydata/dirnode.py | 2 +- src/allmydata/frontends/sftpd.py | 4 ++-- src/allmydata/scripts/tahoe_cp.py | 2 +- src/allmydata/scripts/tahoe_ls.py | 2 +- src/allmydata/test/test_dirnode.py | 18 +++++++++--------- src/allmydata/test/test_drop_upload.py | 2 +- src/allmydata/test/test_encodingutil.py | 6 +++--- src/allmydata/test/test_sftp.py | 4 ++-- src/allmydata/test/test_web.py | 20 ++++++++++---------- src/allmydata/uri.py | 2 +- src/allmydata/web/directory.py | 2 +- 11 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/allmydata/dirnode.py b/src/allmydata/dirnode.py index 022a6e00..e422b67f 100644 --- a/src/allmydata/dirnode.py +++ b/src/allmydata/dirnode.py @@ -546,7 +546,7 @@ class DirectoryNode: writecap, readcap, metadata = e precondition(isinstance(writecap, (str,type(None))), writecap) precondition(isinstance(readcap, (str,type(None))), readcap) - + # We now allow packing unknown nodes, provided they are valid # for this type of directory. child_node = self._create_and_validate_node(writecap, readcap, namex) diff --git a/src/allmydata/frontends/sftpd.py b/src/allmydata/frontends/sftpd.py index 7301f281..328ed6e9 100644 --- a/src/allmydata/frontends/sftpd.py +++ b/src/allmydata/frontends/sftpd.py @@ -799,7 +799,7 @@ class GeneralSFTPFile(PrefixingLogMixin): abandoned = self.abandoned parent = self.parent childname = self.childname - + # has_changed is set when writeChunk is called, not when the write occurs, so # it is correct to optimize out the commit if it is False at the close call. has_changed = self.has_changed @@ -1000,7 +1000,7 @@ class SFTPUserHandler(ConchUser, PrefixingLogMixin): def _abandon_any_heisenfiles(self, userpath, direntry): request = "._abandon_any_heisenfiles(%r, %r)" % (userpath, direntry) self.log(request, level=OPERATIONAL) - + assert isinstance(userpath, str), userpath # First we synchronously mark all heisenfiles matching the userpath or direntry diff --git a/src/allmydata/scripts/tahoe_cp.py b/src/allmydata/scripts/tahoe_cp.py index 694bf353..13537dc0 100644 --- a/src/allmydata/scripts/tahoe_cp.py +++ b/src/allmydata/scripts/tahoe_cp.py @@ -502,7 +502,7 @@ class Copier: return self.copy_file(source, target) if isinstance(target, (LocalDirectoryTarget, TahoeDirectoryTarget)): - # We're copying to an existing directory -- make sure that we + # We're copying to an existing directory -- make sure that we # have target names for everything for (name, source) in sources: if name is None and isinstance(source, TahoeFileSource): diff --git a/src/allmydata/scripts/tahoe_ls.py b/src/allmydata/scripts/tahoe_ls.py index 89ef3347..e64e9d20 100644 --- a/src/allmydata/scripts/tahoe_ls.py +++ b/src/allmydata/scripts/tahoe_ls.py @@ -174,7 +174,7 @@ def list(options): piece += "s" fmt_pieces.append(piece) fmt = " ".join(fmt_pieces) - + rc = 0 for (encoding_error, row) in rows: if encoding_error: diff --git a/src/allmydata/test/test_dirnode.py b/src/allmydata/test/test_dirnode.py index 59b31afb..6f715c99 100644 --- a/src/allmydata/test/test_dirnode.py +++ b/src/allmydata/test/test_dirnode.py @@ -92,7 +92,7 @@ class Dirnode(GridTestMixin, unittest.TestCase, u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), } d = c.create_dirnode(kids) - + def _created(dn): self.failUnless(isinstance(dn, dirnode.DirectoryNode)) self.failUnless(dn.is_mutable()) @@ -104,7 +104,7 @@ class Dirnode(GridTestMixin, unittest.TestCase, self.failUnless("RW-MUT" in rep) return dn.list() d.addCallback(_created) - + def _check_kids(children): self.failUnlessReallyEqual(set(children.keys()), set([one_nfc, u"two", u"mut", u"fut", u"fro", @@ -118,21 +118,21 @@ class Dirnode(GridTestMixin, unittest.TestCase, frona_node, frona_metadata = children[u"fro-unic"] emptylit_node, emptylit_metadata = children[u"empty_litdir"] tinylit_node, tinylit_metadata = children[u"tiny_litdir"] - + self.failUnlessReallyEqual(one_node.get_size(), 3) self.failUnlessReallyEqual(one_node.get_uri(), one_uri) self.failUnlessReallyEqual(one_node.get_readonly_uri(), one_uri) self.failUnless(isinstance(one_metadata, dict), one_metadata) - + self.failUnlessReallyEqual(two_node.get_size(), 14861) self.failUnlessReallyEqual(two_node.get_uri(), setup_py_uri) self.failUnlessReallyEqual(two_node.get_readonly_uri(), setup_py_uri) self.failUnlessEqual(two_metadata["metakey"], "metavalue") - + self.failUnlessReallyEqual(mut_node.get_uri(), mut_write_uri) self.failUnlessReallyEqual(mut_node.get_readonly_uri(), mut_read_uri) self.failUnless(isinstance(mut_metadata, dict), mut_metadata) - + self.failUnless(fut_node.is_unknown()) self.failUnlessReallyEqual(fut_node.get_uri(), future_write_uri) self.failUnlessReallyEqual(fut_node.get_readonly_uri(), "ro." + future_read_uri) @@ -207,7 +207,7 @@ class Dirnode(GridTestMixin, unittest.TestCase, u"tiny_litdir": (nm.create_from_cap(tiny_litdir_uri), {}), } d = c.create_immutable_dirnode(kids) - + def _created(dn): self.failUnless(isinstance(dn, dirnode.DirectoryNode)) self.failIf(dn.is_mutable()) @@ -222,7 +222,7 @@ class Dirnode(GridTestMixin, unittest.TestCase, self.cap = cap return dn.list() d.addCallback(_created) - + def _check_kids(children): self.failUnlessReallyEqual(set(children.keys()), set([one_nfc, u"two", u"fut", u"futna", u"empty_litdir", u"tiny_litdir"])) @@ -270,7 +270,7 @@ class Dirnode(GridTestMixin, unittest.TestCase, return d2 d.addCallback(_check_kids) - + d.addCallback(lambda ign: nm.create_from_cap(self.cap.to_string())) d.addCallback(lambda dn: dn.list()) d.addCallback(_check_kids) diff --git a/src/allmydata/test/test_drop_upload.py b/src/allmydata/test/test_drop_upload.py index a88808f8..beade262 100644 --- a/src/allmydata/test/test_drop_upload.py +++ b/src/allmydata/test/test_drop_upload.py @@ -90,7 +90,7 @@ class DropUploadTestMixin(GridTestMixin, ShouldFailMixin, ReallyEqualMixin): previously_disappeared = self._get_count('drop_upload.files_disappeared') d = defer.Deferred() - + # Note: this relies on the fact that we only get one IN_CLOSE_WRITE notification per file # (otherwise we would get a defer.AlreadyCalledError). Should we be relying on that? self.uploader.set_uploaded_callback(d.callback) diff --git a/src/allmydata/test/test_encodingutil.py b/src/allmydata/test/test_encodingutil.py index b49ca874..96db3410 100644 --- a/src/allmydata/test/test_encodingutil.py +++ b/src/allmydata/test/test_encodingutil.py @@ -40,7 +40,7 @@ if __name__ == "__main__": try: tmpdir = tempfile.mkdtemp() for fname in TEST_FILENAMES: - open(os.path.join(tmpdir, fname), 'w').close() + open(os.path.join(tmpdir, fname), 'w').close() # Use Unicode API under Windows or MacOS X if sys.platform in ('win32', 'darwin'): @@ -166,7 +166,7 @@ class EncodingUtilNonUnicodePlatform(unittest.TestCase): self.failUnlessRaises(FilenameEncodingError, listdir_unicode, u'/dummy') - + # We're trying to list a directory whose name cannot be represented in # the filesystem encoding. This should fail. mock_getfilesystemencoding.return_value = 'ascii' @@ -218,7 +218,7 @@ class EncodingUtil(ReallyEqualMixin): _reload() self.failUnlessReallyEqual(unicode_platform(), matrix[self.platform]) - + @patch('sys.getfilesystemencoding') @patch('os.listdir') def test_listdir_unicode(self, mock_listdir, mock_getfilesystemencoding): diff --git a/src/allmydata/test/test_sftp.py b/src/allmydata/test/test_sftp.py index 76838b04..48874a85 100644 --- a/src/allmydata/test/test_sftp.py +++ b/src/allmydata/test/test_sftp.py @@ -207,7 +207,7 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas def test_convert_error(self): self.failUnlessReallyEqual(sftpd._convert_error(None, "request"), None) - + d = defer.succeed(None) d.addCallback(lambda ign: self.shouldFailWithSFTPError(sftp.FX_FAILURE, "_convert_error SFTPError", @@ -997,7 +997,7 @@ class Handler(GridTestMixin, ShouldFailMixin, ReallyEqualMixin, unittest.TestCas d.addCallback(lambda ign: self.shouldFailWithSFTPError(sftp.FX_NO_SUCH_FILE, "removefile ''", self.handler.removeFile, "")) - + # removing a directory should fail d.addCallback(lambda ign: self.shouldFailWithSFTPError(sftp.FX_PERMISSION_DENIED, "removeFile tiny_lit_dir", diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index 908c6b05..28c1323b 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -1062,7 +1062,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnless(CSS_STYLE.search(res), res) d.addCallback(_check) return d - + def test_GET_FILEURL_uri_missing(self): d = self.GET(self.public_url + "/foo/missing?t=uri") d.addBoth(self.should404, "test_GET_FILEURL_uri_missing") @@ -1120,7 +1120,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi self.failUnless(re.search(get_sub, res), res) d.addCallback(_check) - # look at a readonly directory + # look at a readonly directory d.addCallback(lambda res: self.GET(self.public_url + "/reedownlee", followRedirect=True)) def _check2(res): @@ -3143,10 +3143,10 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi d = self.POST(self.public_url + "/foo/?t=start-manifest&ophandle=%d" % ophandle, followRedirect=True) - # By following the initial redirect, we collect the ophandle + # By following the initial redirect, we collect the ophandle # we've just created. return d - # Create a collected ophandle, then collect it after 23 hours + # Create a collected ophandle, then collect it after 23 hours # and 59 seconds to make sure that it is still there. d = _make_collected_ophandle(133) d.addCallback(lambda ign: @@ -3651,7 +3651,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi d.addCallback(lambda ign: self.GET("%s%s?t=json" % (self.rourl, str(name)))) d.addCallback(_check_json, expect_rw_uri=False) - + # TODO: check that getting t=info from the Info link in the ro directory # works, and does not include the writecap URI. return d @@ -3671,12 +3671,12 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi lonely_uri = "URI:LIT:n5xgk" # LIT for "one" mut_write_uri = "URI:SSK:vfvcbdfbszyrsaxchgevhmmlii:euw4iw7bbnkrrwpzuburbhppuxhc3gwxv26f6imekhz7zyw2ojnq" mut_read_uri = "URI:SSK-RO:e3mdrzfwhoq42hy5ubcz6rp3o4:ybyibhnp3vvwuq2vaw2ckjmesgkklfs6ghxleztqidihjyofgw7q" - + # This method tests mainly dirnode, but we'd have to duplicate code in order to # test the dirnode and web layers separately. - + # 'lonely' is a valid LIT child, 'ro' is a mutant child with an SSK-RO readcap, - # and 'write-in-ro' is a mutant child with an SSK writecap in the ro_uri field. + # and 'write-in-ro' is a mutant child with an SSK writecap in the ro_uri field. # When the directory is read, the mutants should be silently disposed of, leaving # their lonely sibling. # We don't test the case of a retrieving a cap from the encrypted rw_uri field, @@ -3703,7 +3703,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi u"write-in-ro": (mutant_write_in_ro_child, {}), } d = c.create_immutable_dirnode(kids) - + def _created(dn): self.failUnless(isinstance(dn, dirnode.DirectoryNode)) self.failIf(dn.is_mutable()) @@ -3741,7 +3741,7 @@ class Grid(GridTestMixin, WebErrorMixin, ShouldFailMixin, testutil.ReallyEqualMi self.failUnlessReallyEqual(numkids, 3) return self.rootnode.list() d.addCallback(_check_data) - + # Now when we use the real directory listing code, the mutants should be absent. def _check_kids(children): self.failUnlessReallyEqual(sorted(children.keys()), [u"lonely"]) diff --git a/src/allmydata/uri.py b/src/allmydata/uri.py index 9dd5a562..c8a51198 100644 --- a/src/allmydata/uri.py +++ b/src/allmydata/uri.py @@ -657,7 +657,7 @@ def from_string(u, deep_immutable=False, name=u""): error = MustBeDeepImmutableError(kind + " used in an immutable context", name) else: error = MustBeReadonlyError(kind + " used in a read-only context", name) - + except BadURIError, e: error = e diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index c4e6fae8..216a539d 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -352,7 +352,7 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin): charset = get_arg(req, "_charset", "utf-8") name = name.decode(charset) replace = boolean_of_arg(get_arg(req, "replace", "true")) - + # We mustn't pass childcap for the readcap argument because we don't # know whether it is a read cap. Passing a read cap as the writecap # argument will work (it ends up calling NodeMaker.create_from_cap, -- 2.45.2