]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
snapshot filetree work: fix pyflakes complaints
authorBrian Warner <warner@lothar.com>
Fri, 19 Jan 2007 09:35:36 +0000 (02:35 -0700)
committerBrian Warner <warner@lothar.com>
Fri, 19 Jan 2007 09:35:36 +0000 (02:35 -0700)
src/allmydata/filetree/directory.py
src/allmydata/filetree/interfaces.py
src/allmydata/filetree/vdrive.py
src/allmydata/test/test_filetree_new.py
src/allmydata/workqueue.py

index 6e469e780e96221ca49f2d8191c0a5191b7eef34..096f98e338176f57cf063e9c3a48c07cdb0910a2 100644 (file)
@@ -1,10 +1,12 @@
 
 from zope.interface import implements
-from twisted.internet import defer
 from allmydata.filetree.interfaces import (INode,
                                            IDirectoryNode,
                                            ISubTree,
-                                           IMutableSubTree)
+                                           ICHKDirectoryNode, ISSKDirectoryNode,
+                                           NoSuchChildError,
+                                           )
+from allmydata import download
 from allmydata.util import bencode
 
 # interesting feature ideas:
@@ -16,6 +18,14 @@ from allmydata.util import bencode
 #  vice versa.
 
 
+def to_node(spec):
+    # TODO
+    pass
+def to_spec(node):
+    # TODO
+    pass
+
+
 class SubTreeNode:
     implements(INode, IDirectoryNode)
 
@@ -54,7 +64,7 @@ class SubTreeNode:
         if childname in self.subdirectory_node_children:
             del self.subdirectory_node_children[childname]
         elif childname in self.child_specifications:
-            del to_node(self.child_specifications[childname])
+            del self.child_specifications[childname]
         else:
             raise NoSuchChildError("no child named '%s'" % (childname,))
 
index 2051916c96d26e18e5a902a15b87b25146cb7e91..f8744a791515ac09412df563e22909b58d53ac41 100644 (file)
@@ -216,3 +216,21 @@ class IVirtualDrive(Interface):
 
     # ... detach subtree, merge subtree, etc
 
+
+# TODO
+
+class ICHKDirectoryNode(Interface):
+    pass
+class ISSKDirectoryNode(Interface):
+    pass
+
+
+
+class NoSuchChildError(Exception):
+    pass
+class NoSuchDirectoryError(Exception):
+    pass
+class PathAlreadyExistsError(Exception):
+    pass
+class PathDoesNotExistError(Exception):
+    pass
index 1ada7cd819a6e2bab6e1d328b243b3015b23a63e..160c1ce41052a7251c17cf7ee5b3fbf06309ff4c 100644 (file)
@@ -1,14 +1,21 @@
 
-from allmydata.filetree import interfaces, opener
+from zope.interface import implements
+from allmydata.filetree import opener
+from allmydata.filetree.interfaces import (IVirtualDrive, ISubTree, IFileNode,
+                                           IDirectoryNode, NoSuchDirectoryError,
+                                           NoSuchChildError, PathAlreadyExistsError,
+                                           PathDoesNotExistError,
+                                           )
+from allmydata.upload import IUploadable
 
 class VirtualDrive(object):
-    implements(interfaces.IVirtualDrive)
+    implements(IVirtualDrive)
 
     def __init__(self, workqueue, downloader, root_specification):
         self.workqueue = workqueue
         workqueue.set_vdrive(self)
         # TODO: queen?
-        self.opener = Opener(queen, downloader)
+        self.opener = opener.Opener(self.queen, downloader)
         self.root_specification = root_specification
 
     # these methods are used to walk through our subtrees
@@ -59,7 +66,7 @@ class VirtualDrive(object):
         def _got_directory(node):
             if not node:
                 raise NoSuchDirectoryError
-            assert interfaces.IDirectoryNode(node)
+            assert IDirectoryNode(node)
             return node
         d.addCallback(_got_directory)
         return d
index 65bfee3b59b4d33394cc6aa2e293d3e059c717ab..c86adb0a12bd13b99c1dc9843b1e91058e1f4a83 100644 (file)
@@ -1,4 +1,5 @@
 
+"""
 from zope.interface import implements
 from twisted.trial import unittest
 from twisted.internet import defer
@@ -309,3 +310,4 @@ del MultipleSubTrees
 
 class Redirect(unittest.TestCase):
     pass
+"""
index 14e83dfc6d077a3fb7328be1970bebbd3e26cfdf..dcc154f98a397c4631dd2571e147bdda27452121 100644 (file)
@@ -346,7 +346,7 @@ class WorkQueue(object):
     def step_addpath(self, boxname, *path):
         data = self.read_from_box(boxname)
         child_node = unserialize(data) # TODO: unserialize ?
-        return self.vdrive.add(path, node)
+        return self.vdrive.add(path, child_node)
 
     def step_retain_ssk(self, index_a, read_key_a):
         pass