Remove all trailing whitespace from .py files.

This commit is contained in:
david-sarah 2011-08-08 17:11:17 -07:00
parent 08af9cea50
commit bbed522033
11 changed files with 32 additions and 32 deletions

View File

@ -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)

View File

@ -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

View File

@ -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):

View File

@ -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:

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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",

View File

@ -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"])

View File

@ -657,7 +657,7 @@ def from_string(u, deep_immutable=False, name=u"<unknown name>"):
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

View File

@ -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,