]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
hush pyflakes-0.4.0 warnings: remove trivial unused variables. For #900.
authorBrian Warner <warner@lothar.com>
Thu, 14 Jan 2010 22:15:29 +0000 (14:15 -0800)
committerBrian Warner <warner@lothar.com>
Thu, 14 Jan 2010 22:15:29 +0000 (14:15 -0800)
43 files changed:
src/allmydata/dirnode.py
src/allmydata/immutable/download.py
src/allmydata/immutable/upload.py
src/allmydata/mutable/common.py
src/allmydata/mutable/layout.py
src/allmydata/mutable/publish.py
src/allmydata/mutable/servermap.py
src/allmydata/provisioning.py
src/allmydata/reliability.py
src/allmydata/scripts/debug.py
src/allmydata/scripts/stats_gatherer.py
src/allmydata/scripts/tahoe_backup.py
src/allmydata/scripts/tahoe_cp.py
src/allmydata/scripts/tahoe_manifest.py
src/allmydata/scripts/tahoe_rm.py
src/allmydata/storage/crawler.py
src/allmydata/storage/server.py
src/allmydata/test/check_speed.py
src/allmydata/test/common.py
src/allmydata/test/test_client.py
src/allmydata/test/test_crawler.py
src/allmydata/test/test_deepcheck.py
src/allmydata/test/test_dirnode.py
src/allmydata/test/test_encode.py
src/allmydata/test/test_filenode.py
src/allmydata/test/test_hashtree.py
src/allmydata/test/test_immutable.py
src/allmydata/test/test_introducer.py
src/allmydata/test/test_mutable.py
src/allmydata/test/test_storage.py
src/allmydata/test/test_system.py
src/allmydata/test/test_uri.py
src/allmydata/test/test_util.py
src/allmydata/test/test_web.py
src/allmydata/uri.py
src/allmydata/util/base32.py
src/allmydata/util/mathutil.py
src/allmydata/web/check_results.py
src/allmydata/web/directory.py
src/allmydata/web/filenode.py
src/allmydata/web/info.py
src/allmydata/web/reliability.py
src/allmydata/web/storage.py

index ae8516f6e8359f4e80378cc967bb7f3528a8d69f..2951d5a9fad86c78c40960c2987a9054725fdaeb 100644 (file)
@@ -413,7 +413,6 @@ class DirectoryNode:
     def set_children(self, entries, overwrite=True):
         # this takes URIs
         a = Adder(self, overwrite=overwrite)
-        node_entries = []
         for (name, e) in entries.iteritems():
             assert isinstance(name, unicode)
             if len(e) == 2:
index 261b65d666326ef3ec46098324ce1008e9caf584..e087b6181e36471bec4413a4e04d61efe6d99516 100644 (file)
@@ -82,9 +82,9 @@ class ValidatedThingObtainer:
         self._log_id = log_id
 
     def _bad(self, f, validatedthingproxy):
-        failtype = f.trap(RemoteException, DeadReferenceError,
-                          IntegrityCheckReject, layout.LayoutInvalid,
-                          layout.ShareVersionIncompatible)
+        f.trap(RemoteException, DeadReferenceError,
+               IntegrityCheckReject, layout.LayoutInvalid,
+               layout.ShareVersionIncompatible)
         level = log.WEIRD
         if f.check(DeadReferenceError):
             level = log.UNUSUAL
@@ -598,9 +598,9 @@ class BlockDownloader(log.PrefixingLogMixin):
         self.parent.hold_block(self.blocknum, data)
 
     def _got_block_error(self, f):
-        failtype = f.trap(RemoteException, DeadReferenceError,
-                          IntegrityCheckReject,
-                          layout.LayoutInvalid, layout.ShareVersionIncompatible)
+        f.trap(RemoteException, DeadReferenceError,
+               IntegrityCheckReject, layout.LayoutInvalid,
+               layout.ShareVersionIncompatible)
         if f.check(RemoteException, DeadReferenceError):
             level = log.UNUSUAL
         else:
index 0b3bd7d9437bc051710fc0ea75b1f032e3e5b445..72826994588dbd89e61a28ac81e94f93463584a8 100644 (file)
@@ -777,7 +777,6 @@ class CHKUploader:
         for shnum in self._encoder.get_shares_placed():
             peer_tracker = self._peer_trackers[shnum]
             peerid = peer_tracker.peerid
-            peerid_s = idlib.shortnodeid_b2a(peerid)
             r.sharemap.add(shnum, peerid)
             r.servermap.add(peerid, shnum)
         r.pushed_shares = len(self._encoder.get_shares_placed())
index 49a04ff2462363210485677d91cdf374a50e262e..fc217dfd33853141328134557942e07ef44b2a17 100644 (file)
@@ -121,7 +121,6 @@ class ResponseCache:
         # we have a fragment that contains the whole request
 
         index = (verinfo, shnum)
-        end = offset+length
         for entry in self.cache.get(index, set()):
             (e_start, e_data, e_timestamp) = entry
             if self._inside(offset, length, e_start, len(e_data)):
index ee89128cc4d30208cc274158f995b3c2b1693a40..40c7174a9ad0a0ef3364ef807638c775678efe0e 100644 (file)
@@ -166,7 +166,7 @@ def pack_offsets(verification_key_length, signature_length,
     o3 = offsets['block_hash_tree'] = o2 + share_hash_chain_length
     o4 = offsets['share_data'] = o3 + block_hash_tree_length
     o5 = offsets['enc_privkey'] = o4 + share_data_length
-    o6 = offsets['EOF'] = o5 + encprivkey_length
+    offsets['EOF'] = o5 + encprivkey_length
 
     return struct.pack(">LLLLQQ",
                        offsets['signature'],
index 39ed649b91065ea98ca4361603af7f97fd87fa63..7ff4350dae05e2aa0f91f56660a991daf7943e17 100644 (file)
@@ -374,7 +374,6 @@ class Publish:
                                         str(self._first_write_error),
                                         self._first_write_error)
 
-        new_assignments = []
         # we then index this peerlist with an integer, because we may have to
         # wrap. We update the goal as we go.
         i = 0
@@ -465,7 +464,7 @@ class Publish:
             # build the block hash tree. SDMF has only one leaf.
             leaves = [hashutil.block_hash(share_data)]
             t = hashtree.HashTree(leaves)
-            block_hash_trees[shnum] = block_hash_tree = list(t)
+            block_hash_trees[shnum] = list(t)
             share_hash_leaves[shnum] = t[0]
         for leaf in share_hash_leaves:
             assert leaf is not None
index 5798a448fb32a052edb891a834e942e8c83628f7..f47deaef3838e5f5b361dbdf183e15a14ab7dff7 100644 (file)
@@ -500,7 +500,6 @@ class ServermapUpdater:
         self._status.set_status("Sending %d initial queries" % len(peerlist))
         self._queries_outstanding = set()
         self._sharemap = DictOfSets() # shnum -> [(peerid, seqnum, R)..]
-        dl = []
         for (peerid, ss) in peerlist.items():
             self._queries_outstanding.add(peerid)
             self._do_query(ss, peerid, self._storage_index, self._read_size)
index 2990689a6d9f453cca10058d72b1a01ab7fa6fa1..303bf1d0e74e326f3cc6406ed6ffaa51974adcba 100644 (file)
@@ -57,7 +57,6 @@ class ProvisioningTool(rend.Page):
             i_select = T.select(name=name)
             for (count, description) in options:
                 count = astype(count)
-                selected = False
                 if ((current_value is not None and count == current_value) or
                     (current_value is None and count == default)):
                     o = T.option(value=str(count), selected="true")[description]
@@ -340,7 +339,6 @@ class ProvisioningTool(rend.Page):
             add_output("Users",
                        T.div["Average file size: ", number(file_size)])
             total_files = num_users * files_per_user / sharing_ratio
-            user_file_check_interval = file_check_interval / files_per_user
 
             add_output("Grid",
                        T.div["Total number of files in grid: ",
@@ -711,6 +709,7 @@ class ProvisioningTool(rend.Page):
             from allmydata import reliability
             # we import this just to test to see if the page is available
             _hush_pyflakes = reliability
+            del _hush_pyflakes
             f = [T.div[T.a(href="../reliability")["Reliability Math"]], f]
         except ImportError:
             pass
index 76d930f356a67721f464edfba0a00a3e61596c95..a0d60769bdec9ca6d0020868854c647aabf44891 100644 (file)
@@ -79,7 +79,6 @@ class ReliabilityModel:
         #print "DIFF:", (old_post_repair - decay * repair)
 
         START = array([0]*N + [1])
-        ALIVE = array([0]*k + [1]*(1+N-k))
         DEAD = array([1]*k + [0]*(1+N-k))
         REPAIRp = array([0]*k + [1]*(R-k) + [0]*(1+N-R))
         REPAIR_newshares = array([0]*k +
@@ -87,7 +86,6 @@ class ReliabilityModel:
                                  [0]*(1+N-R))
         assert REPAIR_newshares.shape[0] == N+1
         #print "START", START
-        #print "ALIVE", ALIVE
         #print "REPAIRp", REPAIRp
         #print "REPAIR_newshares", REPAIR_newshares
 
index c85bfca305652cebb0cf4f745d1d2db96bd15ab1..c455866bd30e3c5b303c9b77800b45dcb1c93a82 100644 (file)
@@ -553,10 +553,7 @@ def describe_share(abs_sharefile, si_s, shnum_s, now, out):
         # mutable share
         m = MutableShareFile(abs_sharefile)
         WE, nodeid = m._read_write_enabler_and_nodeid(f)
-        num_extra_leases = m._read_num_extra_leases(f)
         data_length = m._read_data_length(f)
-        extra_lease_offset = m._read_extra_lease_offset(f)
-        container_size = extra_lease_offset - m.DATA_OFFSET
         expiration_time = min( [lease.expiration_time
                                 for (i,lease) in m._enumerate_leases(f)] )
         expiration = max(0, expiration_time - now)
index 4d44e67f032812bc4b1653038e10eb813b94b27b..e799d4e8aac96cea7a534671e63c1150b23bb8c1 100644 (file)
@@ -27,7 +27,6 @@ g.setServiceParent(application)
 """
 
 def create_stats_gatherer(config):
-    out = config.stdout
     err = config.stderr
     basedir = config['basedir']
     if not basedir:
index 4f7c70dda10202824d30d271d710d22adf4fe572..122018c982c404b69dd24235149311f16bf9ccbf 100644 (file)
@@ -72,14 +72,11 @@ class BackerUpper:
     def run(self):
         options = self.options
         nodeurl = options['node-url']
-        from_dir = options.from_dir
-        to_dir = options.to_dir
         self.verbosity = 1
         if options['quiet']:
             self.verbosity = 0
         if options['verbose']:
             self.verbosity = 2
-        stdin = options.stdin
         stdout = options.stdout
         stderr = options.stderr
 
@@ -101,7 +98,6 @@ class BackerUpper:
             to_url += "/"
 
         archives_url = to_url + "Archives/"
-        latest_url = to_url + "Latest"
 
         # first step: make sure the target directory exists, as well as the
         # Archives/ subdirectory.
@@ -112,11 +108,6 @@ class BackerUpper:
                 print >>stderr, "Unable to create target directory: %s %s %s" % \
                       (resp.status, resp.reason, resp.read())
                 return 1
-            archives_dir = {}
-        else:
-            jdata = simplejson.load(resp)
-            (otype, attrs) = jdata
-            archives_dir = attrs["children"]
 
         # second step: process the tree
         new_backup_dircap = self.process(options.from_dir)
index 8cf543da91bc6d8f0a4b1261f2c4c4dd9b1f78c0..02052641f5517296db45e3fd5891e115b137018c 100644 (file)
@@ -530,7 +530,6 @@ class Copier:
             url = self.nodeurl + "uri/%s" % urllib.quote(rootcap)
             if path:
                 url += "/" + escape_path(path)
-                last_slash = path.rfind("/")
 
             resp = do_http("GET", url + "?t=json")
             if resp.status == 404:
index 180bf7cb153011fd4342a9e1c8ee4f1e5fa9c5e5..5131aead90ac3fb3cbbb60bc5dcec45fefd8e7e0 100644 (file)
@@ -93,7 +93,6 @@ class StatsGrabber(SlowOperationRunner):
 
     def write_results(self, data):
         stdout = self.options.stdout
-        stderr = self.options.stderr
         keys = ("count-immutable-files",
                 "count-mutable-files",
                 "count-literal-files",
index a0ffe719617beb2930aba2d1e7527405a14545a0..3e854e97b7ebe836a63398a6d2d9b8daf8d2a694 100644 (file)
@@ -5,17 +5,11 @@ from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path
 
 def rm(options):
     """
-    @param verbosity: 0, 1, or 2, meaning quiet, verbose, or very verbose
-
     @return: a Deferred which eventually fires with the exit code
     """
     nodeurl = options['node-url']
     aliases = options.aliases
     where = options.where
-    if options['quiet']:
-        verbosity = 0
-    else:
-        verbosity = 2
     stdout = options.stdout
     stderr = options.stderr
 
index e3a50e42022a1fdedf8865026b98dd80fd7bc1c4..3a917b8d4db5ed9d9630a81a0fd392df5041b8ca 100644 (file)
@@ -258,7 +258,6 @@ class ShareCrawler(service.MultiService):
         self.current_sleep_time = None
         self.next_wake_time = None
         try:
-            s = self.last_complete_prefix_index
             self.start_current_prefix(start_slice)
             finished_cycle = True
         except TimeSliceExceeded:
index 2f71c71ec74112263985139128f90785c700cc86..22ec1621ca6d582a1b135d8bf00b435eb7d33da2 100644 (file)
@@ -76,7 +76,7 @@ class StorageServer(service.MultiService, Referenceable):
         self._clean_incomplete()
         fileutil.make_dirs(self.incomingdir)
         self._active_writers = weakref.WeakKeyDictionary()
-        lp = log.msg("StorageServer created", facility="tahoe.storage")
+        log.msg("StorageServer created", facility="tahoe.storage")
 
         if reserved_space:
             if self.get_available_space() is None:
@@ -479,7 +479,7 @@ class StorageServer(service.MultiService, Referenceable):
         start = time.time()
         self.count("writev")
         si_s = si_b2a(storage_index)
-        lp = log.msg("storage: slot_writev %s" % si_s)
+        log.msg("storage: slot_writev %s" % si_s)
         si_dir = storage_index_to_dir(storage_index)
         (write_enabler, renew_secret, cancel_secret) = secrets
         # shares exist if there is a file for them
index 84c21d47a1c5dbf8ef0f21d5ced851460e4617f4..8be4ca07f32228e4d4b1979b1cbba85475e594c8 100644 (file)
@@ -95,7 +95,6 @@ class SpeedTest:
 
     def do_test(self):
         print "doing test"
-        rr = self.client_rref
         d = defer.succeed(None)
         d.addCallback(self.one_test, "startup", 1, 1000, False) #ignore this one
         d.addCallback(self.measure_rtt)
index 45e6fcd3dfb4bf5df757432175ea8c67cf59851f..538f6627a72f81662c6dacb78df0c40eca596e4f 100644 (file)
@@ -1335,18 +1335,11 @@ def _corrupt_crypttext_hash_tree(data, debug=False):
     return corrupt_field(data, 0x0c+crypttexthashtreeoffset, blockhashesoffset-crypttexthashtreeoffset, debug=debug)
 
 def _corrupt_crypttext_hash_tree_byte_x221(data, debug=False):
-    """Scramble the file data -- the field containing the crypttext hash tree
-    will have the 7th bit of the 9th byte flipped.
+    """Scramble the file data -- the byte at offset 0x221 will have its 7th
+    (b1) bit flipped.
     """
     sharevernum = struct.unpack(">L", data[0x0c:0x0c+4])[0]
     assert sharevernum in (1, 2), "This test is designed to corrupt immutable shares of v1 or v2 in specific ways."
-    if sharevernum == 1:
-        crypttexthashtreeoffset = struct.unpack(">L", data[0x0c+0x14:0x0c+0x14+4])[0]
-        blockhashesoffset = struct.unpack(">L", data[0x0c+0x18:0x0c+0x18+4])[0]
-    else:
-        crypttexthashtreeoffset = struct.unpack(">Q", data[0x0c+0x24:0x0c+0x24+8])[0]
-        blockhashesoffset = struct.unpack(">Q", data[0x0c+0x2c:0x0c+0x2c+8])[0]
-
     if debug:
         log.msg("original data: %r" % (data,))
     return data[:0x0c+0x221] + chr(ord(data[0x0c+0x221])^0x02) + data[0x0c+0x2210+1:]
index 9d8f4756124dc923e4011a30c2ded40a8d2e8efa..beb6abe895d87a25f28121648ed3aa75c11232b4 100644 (file)
@@ -32,7 +32,7 @@ class Basic(unittest.TestCase):
         basedir = "test_client.Basic.test_loadable"
         os.mkdir(basedir)
         open(os.path.join(basedir, "introducer.furl"), "w").write("")
-        c = client.Client(basedir)
+        client.Client(basedir)
 
     def test_loadable_old_config_bits(self):
         basedir = "test_client.Basic.test_loadable_old_config_bits"
@@ -190,7 +190,7 @@ class Run(unittest.TestCase, testutil.StallMixin):
         dummy = "pb://wl74cyahejagspqgy4x5ukrvfnevlknt@127.0.0.1:58889/bogus"
         open(os.path.join(basedir, "introducer.furl"), "w").write(dummy)
         open(os.path.join(basedir, "suicide_prevention_hotline"), "w")
-        c = client.Client(basedir)
+        client.Client(basedir)
 
     def test_reloadable(self):
         basedir = "test_client.Run.test_reloadable"
index 4caa29064b06c430f68bc49c25de010ede5cc659..1c57e134a0be8b3b7cbe85f3121393f3f6c50e4e 100644 (file)
@@ -341,7 +341,8 @@ class Basic(unittest.TestCase, StallMixin, pollmixin.PollMixin):
         ss = StorageServer(self.basedir, serverid)
         ss.setServiceParent(self.s)
 
-        sis = [self.write(i, ss, serverid) for i in range(10)]
+        for i in range(10):
+            self.write(i, ss, serverid)
 
         statefile = os.path.join(self.basedir, "statefile")
         c = ConsumingCrawler(ss, statefile)
@@ -385,7 +386,8 @@ class Basic(unittest.TestCase, StallMixin, pollmixin.PollMixin):
         ss = StorageServer(self.basedir, serverid)
         ss.setServiceParent(self.s)
 
-        sis = [self.write(i, ss, serverid) for i in range(10)]
+        for i in range(10):
+            self.write(i, ss, serverid)
 
         statefile = os.path.join(self.basedir, "statefile")
         c = ShareCrawler(ss, statefile)
@@ -412,7 +414,8 @@ class Basic(unittest.TestCase, StallMixin, pollmixin.PollMixin):
         ss = StorageServer(self.basedir, serverid)
         ss.setServiceParent(self.s)
 
-        sis = [self.write(i, ss, serverid) for i in range(30)]
+        for i in range(30):
+            self.write(i, ss, serverid)
 
         statefile = os.path.join(self.basedir, "statefile")
         c = OneShotCrawler(ss, statefile)
index 165013c586f8a4f2249fb0a476d52deb49a08fb1..55e85680d07fe3f50bc46e5433795931aca25914 100644 (file)
@@ -38,7 +38,6 @@ class MutableChecker(GridTestMixin, unittest.TestCase, ErrorMixin):
         def _created(node):
             self.node = node
             self.fileurl = "uri/" + urllib.quote(node.get_uri())
-            si = self.node.get_storage_index()
         d.addCallback(_created)
         # now make sure the webapi verifier sees no problems
         d.addCallback(lambda ign: self.GET(self.fileurl+"?t=check&verify=true",
@@ -395,13 +394,14 @@ class DeepCheckWebGood(DeepCheckBase, unittest.TestCase):
         self.check_stats_good(stats)
 
     def do_web_stream_check(self, ignored):
+        # TODO
         return
         d = self.web(self.root, t="stream-deep-check")
         def _check(res):
             units = list(self.parse_streamed_json(res))
-            files = [u for u in units if u["type"] in ("file", "directory")]
+            #files = [u for u in units if u["type"] in ("file", "directory")]
             assert units[-1]["type"] == "stats"
-            stats = units[-1]["stats"]
+            #stats = units[-1]["stats"]
             # ...
         d.addCallback(_check)
         return d
index fd591bedae5d48b5a402393191f6df121a124f1a..a45b37f30f333a8ce51af909c70d91119a74d898 100644 (file)
@@ -294,7 +294,6 @@ class Dirnode(GridTestMixin, unittest.TestCase,
         return d
 
     def _mark_file_bad(self, rootnode):
-        si = rootnode.get_storage_index()
         self.delete_shares_numbered(rootnode.get_uri(), [0])
         return rootnode
 
@@ -976,25 +975,25 @@ class Packing(unittest.TestCase):
         self.failUnlessIn("lit", packed)
 
         kids = self._make_kids(nm, ["imm", "lit", "write"])
-        e = self.failUnlessRaises(dirnode.MustBeDeepImmutable,
-                                  dirnode.pack_children,
-                                  fn, kids, deep_immutable=True)
+        self.failUnlessRaises(dirnode.MustBeDeepImmutable,
+                              dirnode.pack_children,
+                              fn, kids, deep_immutable=True)
 
         # read-only is not enough: all children must be immutable
         kids = self._make_kids(nm, ["imm", "lit", "read"])
-        e = self.failUnlessRaises(dirnode.MustBeDeepImmutable,
-                                  dirnode.pack_children,
-                                  fn, kids, deep_immutable=True)
+        self.failUnlessRaises(dirnode.MustBeDeepImmutable,
+                              dirnode.pack_children,
+                              fn, kids, deep_immutable=True)
 
         kids = self._make_kids(nm, ["imm", "lit", "dirwrite"])
-        e = self.failUnlessRaises(dirnode.MustBeDeepImmutable,
-                                  dirnode.pack_children,
-                                  fn, kids, deep_immutable=True)
+        self.failUnlessRaises(dirnode.MustBeDeepImmutable,
+                              dirnode.pack_children,
+                              fn, kids, deep_immutable=True)
 
         kids = self._make_kids(nm, ["imm", "lit", "dirread"])
-        e = self.failUnlessRaises(dirnode.MustBeDeepImmutable,
-                                  dirnode.pack_children,
-                                  fn, kids, deep_immutable=True)
+        self.failUnlessRaises(dirnode.MustBeDeepImmutable,
+                              dirnode.pack_children,
+                              fn, kids, deep_immutable=True)
 
 class FakeMutableFile:
     implements(IMutableFileNode)
index 2d91dbc581b9aace89a0e00b4b6f8a78b072a37e..82e9056b94113f671d9bd645da61077d6ffe1723 100644 (file)
@@ -457,7 +457,6 @@ class Roundtrip(unittest.TestCase, testutil.ShouldFailMixin):
         def _ready(res):
             k,happy,n = e.get_param("share_counts")
             assert n == NUM_SHARES # else we'll be completely confused
-            all_peers = []
             for shnum in range(NUM_SHARES):
                 mode = bucket_modes.get(shnum, "good")
                 peer = FakeBucketReaderWriterProxy(mode)
index a8de4207bf90c27e63515b4f7456bb133f2541c8..a8ea9969effa9cced13f465062081cb9cb451087 100644 (file)
@@ -30,7 +30,6 @@ class Node(unittest.TestCase):
                            needed_shares=3,
                            total_shares=10,
                            size=1000)
-        c = FakeClient()
         cf = cachedir.CacheFile("none")
         fn1 = ImmutableFileNode(u, None, None, None, None, cf)
         fn2 = ImmutableFileNode(u, None, None, None, None, cf)
@@ -55,7 +54,6 @@ class Node(unittest.TestCase):
     def test_literal_filenode(self):
         DATA = "I am a short file."
         u = uri.LiteralFileURI(data=DATA)
-        c = None
         fn1 = LiteralFileNode(u)
         fn2 = LiteralFileNode(u)
         self.failUnlessEqual(fn1, fn2)
@@ -91,7 +89,6 @@ class Node(unittest.TestCase):
     def test_mutable_filenode(self):
         client = FakeClient()
         wk = "\x00"*16
-        fp = "\x00"*32
         rk = hashutil.ssk_readkey_hash(wk)
         si = hashutil.ssk_storage_index_hash(rk)
 
index 30d99194b5b8b8d0dbcbfc3a27818b3e415cd666..abcf4eb1b4e73a19f1af9eb8871981a7cba0a318 100644 (file)
@@ -81,7 +81,7 @@ class Incomplete(unittest.TestCase):
         self.failUnlessEqual(ht.needed_hashes(5, True), set([12, 11, 6, 1]))
 
     def test_depth_of(self):
-        ht = hashtree.IncompleteHashTree(8)
+        hashtree.IncompleteHashTree(8)
         self.failUnlessEqual(hashtree.depth_of(0), 0)
         for i in [1,2]:
             self.failUnlessEqual(hashtree.depth_of(i), 1, "i=%d"%i)
index c9dfc064f97fdd27230f88ac0d913594a648ecd0..418956c44bd0499a26a1a29ffbb535fa000707b8 100644 (file)
@@ -78,7 +78,7 @@ class Test(common.ShareManglingMixin, unittest.TestCase):
             random.shuffle(shnums)
             for i in shnums[:7]:
                 self._corrupt_a_share(None, common._corrupt_offset_of_block_hashes_to_truncate_crypttext_hashes, i)
-        before_download_reads = self._count_reads()
+        #before_download_reads = self._count_reads()
         d.addCallback(_then_corrupt_7)
         d.addCallback(self._download_and_check_plaintext)
         return d
index 7958158df24ef785a985fd02e76561446b58f6be..9da6dccef45531c8d33c78581ce976fc65e1fde7 100644 (file)
@@ -129,7 +129,7 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
             log.msg("creating client %d: %s" % (i, tub.getShortTubID()))
             c = IntroducerClient(tub, self.introducer_furl, u"nickname-%d" % i,
                                  "version", "oldest")
-            received_announcements[c] = ra = {}
+            received_announcements[c] = {}
             def got(serverid, ann_d, announcements):
                 announcements[serverid] = ann_d
             c.subscribe_to("storage", got, received_announcements[c])
index a79197afdf10b289110cc06281a40a62d9ed5bb3..8afec13fde27b45eb7cb875650fb5ff5af8cf8f8 100644 (file)
@@ -6,7 +6,6 @@ from twisted.internet import defer, reactor
 from allmydata import uri, client
 from allmydata.nodemaker import NodeMaker
 from allmydata.util import base32
-from allmydata.util.idlib import shortnodeid_b2a
 from allmydata.util.hashutil import tagged_hash, ssk_writekey_hash, \
      ssk_pubkey_fingerprint_hash
 from allmydata.interfaces import IRepairResults, ICheckAndRepairResults, \
@@ -71,7 +70,6 @@ class FakeStorage:
         self._pending_timer = None
         pending = self._pending
         self._pending = {}
-        extra = []
         for peerid in self._sequence:
             if peerid in pending:
                 d, shares = pending.pop(peerid)
@@ -602,7 +600,6 @@ class PublishMixin:
         # publish a file and create shares, which can then be manipulated
         # later.
         self.CONTENTS = "New contents go here" * 1000
-        num_peers = 20
         self._storage = FakeStorage()
         self._nodemaker = make_nodemaker(self._storage)
         self._storage_broker = self._nodemaker.storage_broker
@@ -620,7 +617,6 @@ class PublishMixin:
                          "Contents 3a",
                          "Contents 3b"]
         self._copied_shares = {}
-        num_peers = 20
         self._storage = FakeStorage()
         self._nodemaker = make_nodemaker(self._storage)
         d = self._nodemaker.create_mutable_file(self.CONTENTS[0]) # seqnum=1
@@ -757,7 +753,6 @@ class Servermap(unittest.TestCase, PublishMixin):
     def test_mark_bad(self):
         d = defer.succeed(None)
         ms = self.make_servermap
-        us = self.update_servermap
 
         d.addCallback(lambda res: ms(mode=MODE_READ))
         d.addCallback(lambda sm: self.failUnlessOneRecoverable(sm, 6))
@@ -1435,7 +1430,6 @@ class Repair(unittest.TestCase, PublishMixin, ShouldFailMixin):
             self.failUnlessEqual(len(smap.recoverable_versions()), 1)
             self.failIf(smap.unrecoverable_versions())
             # now, which should have won?
-            roothash_s4a = self.get_roothash_for(3)
             expected_contents = self.CONTENTS[3]
             new_versionid = smap.best_recoverable_version()
             self.failUnlessEqual(new_versionid[0], 5) # seqnum 5
@@ -1586,7 +1580,6 @@ class MultipleEncodings(unittest.TestCase):
             sb = self._storage_broker
 
             for peerid in sorted(sb.get_all_serverids()):
-                peerid_s = shortnodeid_b2a(peerid)
                 for shnum in self._shares1.get(peerid, {}):
                     if shnum < len(places):
                         which = places[shnum]
@@ -1596,7 +1589,6 @@ class MultipleEncodings(unittest.TestCase):
                     in_1 = shnum in self._shares1[peerid]
                     in_2 = shnum in self._shares2.get(peerid, {})
                     in_3 = shnum in self._shares3.get(peerid, {})
-                    #print peerid_s, shnum, which, in_1, in_2, in_3
                     if which == 1:
                         if in_1:
                             peers[shnum] = self._shares1[peerid][shnum]
index 7538b3908f56c7f2b80400aee04a1ec6041b425a..a1a9f7ab62af4a2a8ea2c0fad9b4f685ab0e0ecd 100644 (file)
@@ -253,7 +253,7 @@ class Server(unittest.TestCase):
         return ss
 
     def test_create(self):
-        ss = self.create("test_create")
+        self.create("test_create")
 
     def allocate(self, ss, storage_index, sharenums, size, canary=None):
         renew_secret = hashutil.tagged_hash("blah", "%d" % self._lease_secret.next())
@@ -326,7 +326,6 @@ class Server(unittest.TestCase):
 
         self.failUnlessEqual(ss.remote_get_buckets("allocate"), {})
 
-        canary = FakeCanary()
         already,writers = self.allocate(ss, "allocate", [0,1,2], 75)
         self.failUnlessEqual(already, set())
         self.failUnlessEqual(set(writers.keys()), set([0,1,2]))
@@ -387,7 +386,7 @@ class Server(unittest.TestCase):
         f.write(struct.pack(">L", 0)) # this is invalid: minimum used is v1
         f.close()
 
-        b = ss.remote_get_buckets("allocate")
+        ss.remote_get_buckets("allocate")
 
         e = self.failUnlessRaises(UnknownImmutableContainerVersionError,
                                   ss.remote_get_buckets, "si1")
@@ -654,7 +653,6 @@ class Server(unittest.TestCase):
         ss = StorageServer(workdir, "\x00" * 20, discard_storage=True)
         ss.setServiceParent(self.sparent)
 
-        canary = FakeCanary()
         already,writers = self.allocate(ss, "vid", [0,1,2], 75)
         self.failUnlessEqual(already, set())
         self.failUnlessEqual(set(writers.keys()), set([0,1,2]))
@@ -733,7 +731,7 @@ class MutableServer(unittest.TestCase):
         return ss
 
     def test_create(self):
-        ss = self.create("test_create")
+        self.create("test_create")
 
     def write_enabler(self, we_tag):
         return hashutil.tagged_hash("we_blah", we_tag)
index fc2d09128ea37a87df307ad521c1bd97108a07f0..6b439a083bb36936b578806337539185036f61e1 100644 (file)
@@ -465,7 +465,6 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
             def _done(res):
                 log.msg("DONE: %s" % (res,))
                 self._mutable_node_1 = res
-                uri = res.get_uri()
             d1.addCallback(_done)
             return d1
         d.addCallback(_create_mutable)
@@ -1364,13 +1363,11 @@ class SystemTest(SystemTestMixin, unittest.TestCase):
         # network calls)
 
         private_uri = self._private_node.get_uri()
-        some_uri = self._root_directory_uri
         client0_basedir = self.getdir("client0")
 
         nodeargs = [
             "--node-directory", client0_basedir,
             ]
-        TESTDATA = "I will not write the same thing over and over.\n" * 100
 
         d = defer.succeed(None)
 
index 6b4c3e533cbe6821bc6b146955f0d8c5f2599029..41d5927f93c94f4a90e6ce59c395574c4f0e3802 100644 (file)
@@ -380,7 +380,6 @@ class Dirnode(unittest.TestCase):
         u0 = uri.LiteralFileURI("data")
         u1 = uri.LiteralDirectoryURI(u0)
         self.failUnless(str(u1))
-        u1s = u1.to_string()
         self.failUnlessEqual(u1.to_string(), "URI:DIR2-LIT:mrqxiyi")
         self.failUnless(u1.is_readonly())
         self.failIf(u1.is_mutable())
index 6607d458a2a1fd54f4644f17db669b41e9008abd..f66d55f637d2bc898e8c8ef367b1f89b7132e92c 100644 (file)
@@ -176,7 +176,7 @@ class Statistics(unittest.TestCase):
         try:
             func(*args, **kwargs)
             self.fail(msg)
-        except AssertionError, e:
+        except AssertionError:
             pass
 
     def failUnlessListEqual(self, a, b, msg = None):
@@ -320,9 +320,6 @@ class Asserts(unittest.TestCase):
         self.fail("assert was not caught")
 
     def should_not_assert(self, func, *args, **kwargs):
-        if "re" in kwargs:
-            regexp = kwargs["re"]
-            del kwargs["re"]
         try:
             func(*args, **kwargs)
         except AssertionError, e:
index 529afe76f948ae50421b4c5661914094057bf0d0..32765df68cb272b85a91ca09d7af23b46067f4ef 100644 (file)
@@ -438,6 +438,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
         try:
             from allmydata import reliability
             _hush_pyflakes = reliability
+            del _hush_pyflakes
         except:
             raise unittest.SkipTest("reliability tool requires NumPy")
 
@@ -483,7 +484,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, unittest.TestCase):
         def _check_json(res):
             data = simplejson.loads(res)
             self.failUnless(isinstance(data, dict))
-            active = data["active"]
+            #active = data["active"]
             # TODO: test more. We need a way to fake an active operation
             # here.
         d.addCallback(_check_json)
index 7c0bc10f5c026d79691f8babe55555a16d3999ed..ec8977297f94702ae4aea70885f29feb80adcba3 100644 (file)
@@ -529,7 +529,7 @@ def from_string(s):
 
 def is_uri(s):
     try:
-        uri = from_string(s)
+        from_string(s)
         return True
     except (TypeError, AssertionError):
         return False
index a943cacc6c2620dd642cfca572158fb3a3da0ca5..00424af52f548c803c94234327321c90215df46d 100644 (file)
@@ -247,7 +247,6 @@ def a2b_l(cs, lengthinbits):
     octets = []
     pos = 2048
     num = qs[0] * pos
-    readybits = 5
     i = 1
     while len(octets) < numoctets:
         while pos > 256:
index ab7ebab852ef9a5f40169764e23c2be6212ad28e..bbdb40b08492a76269ea07f7ebe924c9e1cc63f6 100644 (file)
@@ -33,7 +33,6 @@ def next_power_of_k(n, k):
         x = 0
     else:
         x = int(math.log(n, k) + 0.5)
-    r = k**x
     if k**x < n:
         return k**(x+1)
     else:
index 0f12f66e44356f7a94b547c0e9f454c3041a678e..96ce17bf4490dad7144633410a7aa5ac2cefe04b 100644 (file)
@@ -177,7 +177,6 @@ class ResultsBase:
 
     def _render_si_link(self, ctx, storage_index):
         si_s = base32.b2a(storage_index)
-        root = get_root(ctx)
         req = inevow.IRequest(ctx)
         ophandle = req.prepath[-1]
         target = "%s/operations/%s/%s" % (get_root(ctx), ophandle, si_s)
index d38c6457e85e41134ace8e041a414e5d80625b13..6b4faa0305ec72a997fd8caba2aa5fbf76519c6b 100644 (file)
@@ -60,7 +60,6 @@ class DirectoryNodeHandler(RenderMixin, rend.Page, ReplaceMeMixin):
         self.name = name
 
     def childFactory(self, ctx, name):
-        req = IRequest(ctx)
         name = name.decode("utf-8")
         if not name:
             raise EmptyPathnameComponentError()
index 9fd44022a61404a2ac843140a2a0bb313676623b..a2a1a6a926b3e6b8f583b5cbb79821aee9f9ed8c 100644 (file)
@@ -355,7 +355,6 @@ class FileDownloader(rend.Page):
         if encoding:
             req.setHeader("content-encoding", encoding)
 
-        save_to_filename = None
         if boolean_of_arg(get_arg(req, "save", "False")):
             # tell the browser to save the file rather display it we don't
             # try to encode the filename, instead we echo back the exact same
index 6e95452117bc019e2b2032500c54703d3285a276..c00465f39cfe686e614fbba04f4e80d20554b30d 100644 (file)
@@ -53,7 +53,6 @@ class MoreInfo(rend.Page):
 
     def render_size(self, ctx, data):
         node = self.original
-        si = node.get_storage_index()
         d = node.get_current_size()
         def _no_size(size):
             if size is None:
index 5c8683ce0903c563458be2d721389c7da522b194..d5d340615a4c33ebf5f86a586cef220fc924c443 100644 (file)
@@ -1,5 +1,5 @@
 
-from nevow import rend, inevow, tags as T
+from nevow import rend, tags as T
 reliability = None # might not be usable
 try:
     from allmydata import reliability # requires NumPy
@@ -58,7 +58,6 @@ class ReliabilityTool(rend.Page):
         return "%d" % s
 
     def get_parameters(self, ctx):
-        req = inevow.IRequest(ctx)
         parameters = {}
         for (name,default,argtype,description) in self.DEFAULT_PARAMETERS:
             v = get_arg(ctx, name, default)
index 29f2c3a9630a484b27b213a65da26ce1ce749ead..1943d00f28c5f6a75f6f33747e9a3a8746f63a71 100644 (file)
@@ -184,7 +184,6 @@ class StorageStatus(rend.Page):
         ecr = ec["space-recovered"]
 
         p = T.ul()
-        pieces = []
         def add(*pieces):
             p[T.li[pieces]]
 
@@ -243,7 +242,6 @@ class StorageStatus(rend.Page):
                 ]
 
         p = T.ul()
-        pieces = []
         def add(*pieces):
             p[T.li[pieces]]