From: Brian Warner Date: Fri, 19 Jan 2007 09:35:36 +0000 (-0700) Subject: snapshot filetree work: fix pyflakes complaints X-Git-Tag: tahoe_v0.1.0-0-UNSTABLE~350 X-Git-Url: https://git.rkrishnan.org/vdrive/components/COPYING.GPL?a=commitdiff_plain;h=8921c1b666b209c36e122635e5ef2320fc80e686;p=tahoe-lafs%2Ftahoe-lafs.git snapshot filetree work: fix pyflakes complaints --- diff --git a/src/allmydata/filetree/directory.py b/src/allmydata/filetree/directory.py index 6e469e78..096f98e3 100644 --- a/src/allmydata/filetree/directory.py +++ b/src/allmydata/filetree/directory.py @@ -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,)) diff --git a/src/allmydata/filetree/interfaces.py b/src/allmydata/filetree/interfaces.py index 2051916c..f8744a79 100644 --- a/src/allmydata/filetree/interfaces.py +++ b/src/allmydata/filetree/interfaces.py @@ -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 diff --git a/src/allmydata/filetree/vdrive.py b/src/allmydata/filetree/vdrive.py index 1ada7cd8..160c1ce4 100644 --- a/src/allmydata/filetree/vdrive.py +++ b/src/allmydata/filetree/vdrive.py @@ -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 diff --git a/src/allmydata/test/test_filetree_new.py b/src/allmydata/test/test_filetree_new.py index 65bfee3b..c86adb0a 100644 --- a/src/allmydata/test/test_filetree_new.py +++ b/src/allmydata/test/test_filetree_new.py @@ -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 +""" diff --git a/src/allmydata/workqueue.py b/src/allmydata/workqueue.py index 14e83dfc..dcc154f9 100644 --- a/src/allmydata/workqueue.py +++ b/src/allmydata/workqueue.py @@ -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