Correct harmless indentation errors found by pylint

This commit is contained in:
david-sarah 2010-02-25 23:21:51 -07:00
parent e76092e16c
commit a80f19a084
4 changed files with 41 additions and 41 deletions

View File

@ -119,7 +119,7 @@ def get_linux_distro():
if _distname and _version:
return (_distname, _version)
except EnvironmentError:
pass
pass
(_distname, _version) = platform.dist()[:2]
if _distname and _version:

View File

@ -79,16 +79,16 @@ class FakeCHKFileNode:
data["count-recoverable-versions"] = 1
data["count-unrecoverable-versions"] = 0
if is_bad:
r.set_healthy(False)
r.set_recoverable(True)
data["count-shares-good"] = 9
data["list-corrupt-shares"] = [(nodeid, self.storage_index, 0)]
r.problems = failure.Failure(CorruptShareError(is_bad))
r.set_healthy(False)
r.set_recoverable(True)
data["count-shares-good"] = 9
data["list-corrupt-shares"] = [(nodeid, self.storage_index, 0)]
r.problems = failure.Failure(CorruptShareError(is_bad))
else:
r.set_healthy(True)
r.set_recoverable(True)
data["count-shares-good"] = 10
r.problems = []
r.set_healthy(True)
r.set_recoverable(True)
data["count-shares-good"] = 10
r.problems = []
r.set_data(data)
r.set_needs_rebalancing(False)
return defer.succeed(r)
@ -250,17 +250,17 @@ class FakeMutableFileNode:
data["count-recoverable-versions"] = 1
data["count-unrecoverable-versions"] = 0
if is_bad:
r.set_healthy(False)
r.set_recoverable(True)
data["count-shares-good"] = 9
r.problems = failure.Failure(CorruptShareError("peerid",
0, # shnum
is_bad))
r.set_healthy(False)
r.set_recoverable(True)
data["count-shares-good"] = 9
r.problems = failure.Failure(CorruptShareError("peerid",
0, # shnum
is_bad))
else:
r.set_healthy(True)
r.set_recoverable(True)
data["count-shares-good"] = 10
r.problems = []
r.set_healthy(True)
r.set_recoverable(True)
data["count-shares-good"] = 10
r.problems = []
r.set_data(data)
r.set_needs_rebalancing(False)
return defer.succeed(r)

View File

@ -51,19 +51,19 @@ class HungServerDownloadTest(GridTestMixin, ShouldFailMixin, unittest.TestCase):
self._copy_share((i_shnum, i_sharefile), to_server)
def _copy_share(self, share, to_server):
(sharenum, sharefile) = share
(id, ss) = to_server
shares_dir = os.path.join(ss.original.storedir, "shares")
si = uri.from_string(self.uri).get_storage_index()
si_dir = os.path.join(shares_dir, storage_index_to_dir(si))
if not os.path.exists(si_dir):
os.makedirs(si_dir)
new_sharefile = os.path.join(si_dir, str(sharenum))
shutil.copy(sharefile, new_sharefile)
self.shares = self.find_shares(self.uri)
# Make sure that the storage server has the share.
self.failUnless((sharenum, ss.original.my_nodeid, new_sharefile)
in self.shares)
(sharenum, sharefile) = share
(id, ss) = to_server
shares_dir = os.path.join(ss.original.storedir, "shares")
si = uri.from_string(self.uri).get_storage_index()
si_dir = os.path.join(shares_dir, storage_index_to_dir(si))
if not os.path.exists(si_dir):
os.makedirs(si_dir)
new_sharefile = os.path.join(si_dir, str(sharenum))
shutil.copy(sharefile, new_sharefile)
self.shares = self.find_shares(self.uri)
# Make sure that the storage server has the share.
self.failUnless((sharenum, ss.original.my_nodeid, new_sharefile)
in self.shares)
def _corrupt_share(self, share, corruptor_func):
(sharenum, sharefile) = share

View File

@ -231,14 +231,14 @@ class Unknown(unittest.TestCase):
class Constraint(unittest.TestCase):
def test_constraint(self):
good="http://127.0.0.1:3456/uri/URI%3ADIR2%3Agh3l5rbvnv2333mrfvalmjfr4i%3Alz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma/"
uri.DirectoryURI.init_from_human_encoding(good)
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_string, good)
bad = good + '==='
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_human_encoding, bad)
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_string, bad)
fileURI = 'URI:CHK:gh3l5rbvnv2333mrfvalmjfr4i:lz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma:3:10:345834'
uri.CHKFileURI.init_from_string(fileURI)
good="http://127.0.0.1:3456/uri/URI%3ADIR2%3Agh3l5rbvnv2333mrfvalmjfr4i%3Alz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma/"
uri.DirectoryURI.init_from_human_encoding(good)
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_string, good)
bad = good + '==='
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_human_encoding, bad)
self.failUnlessRaises(uri.BadURIError, uri.DirectoryURI.init_from_string, bad)
fileURI = 'URI:CHK:gh3l5rbvnv2333mrfvalmjfr4i:lz6l7u3z3b7g37s4zkdmfpx5ly4ib4m6thrpbusi6ys62qtc6mma:3:10:345834'
uri.CHKFileURI.init_from_string(fileURI)
class Mutable(unittest.TestCase):
def test_pack(self):