From: david-sarah Date: Fri, 26 Feb 2010 06:21:51 +0000 (-0700) Subject: Correct harmless indentation errors found by pylint X-Git-Tag: trac-4400~70 X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/uri/reliability?a=commitdiff_plain;h=a80f19a084c1fcb12a84e75ede7813d9e4923202;p=tahoe-lafs%2Ftahoe-lafs.git Correct harmless indentation errors found by pylint --- diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index e098e0eb..dba4513c 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -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: diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index b3784cb3..8f790130 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -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) diff --git a/src/allmydata/test/test_hung_server.py b/src/allmydata/test/test_hung_server.py index 4aef4849..111a299f 100644 --- a/src/allmydata/test/test_hung_server.py +++ b/src/allmydata/test/test_hung_server.py @@ -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 diff --git a/src/allmydata/test/test_uri.py b/src/allmydata/test/test_uri.py index f6254eb4..5cbcb085 100644 --- a/src/allmydata/test/test_uri.py +++ b/src/allmydata/test/test_uri.py @@ -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):