from allmydata.immutable.offloaded import Helper
from allmydata.control import ControlServer
from allmydata.introducer.client import IntroducerClient
-from allmydata.util import fileutil, hashutil, base32, pollmixin, log, keyutil, idlib
+from allmydata.util import hashutil, base32, pollmixin, log, keyutil, idlib
from allmydata.util.encodingutil import get_filesystem_encoding, \
from_utf8_or_none
from allmydata.util.fileutil import abspath_expanduser_unicode
d = defer.succeed(None)
collective_dirmap, others_list = result
for dir_name in others_list:
- # XXX this is broken
- d.addCallback(lambda x: self._scan_remote(dir_name, collective_dirmap[dir_name][0]))
+ d.addCallback(lambda x, dir_name=dir_name: self._scan_remote(dir_name, collective_dirmap[dir_name][0]))
collective_dirmap_d.addCallback(self._filter_scan_batch)
collective_dirmap_d.addCallback(self._add_batch_to_download_queue)
return d
self._stats_provider.count('magic_folder.objects_downloaded', +1)
return None
def failed(f):
- return failure.Failure("download failed")
+ return Failure("download failed")
def remove_from_pending(result):
self._download_pending = self._download_pending.difference(set([name]))
d.addCallbacks(succeeded, failed)
def _db_file_is_uploaded(self, childpath):
"""_db_file_is_uploaded returns true if the file was previously uploaded
- """
+ """
assert self._db != None
r = self._db.check_file(childpath)
filecap = r.was_uploaded()
try:
metadata_d = self._upload_dirnode.get_metadata_for(name)
except KeyError:
- return failure.Failure()
+ return Failure()
return metadata_d
if not os.path.exists(path):
import os, json
from cStringIO import StringIO
-from twisted.python import usage, failure
+from twisted.python import usage
-from allmydata.scripts.common import BaseOptions
from .common import BaseOptions, BasedirOptions, get_aliases
from .cli import MakeDirectoryOptions, ListOptions, LnOptions
import tahoe_ls, tahoe_mv
from allmydata.util import fileutil
-from allmydata.util.fileutil import abspath_expanduser_unicode
INVITE_SEPERATOR = "~"
import os.path
-import urllib
import re
import json
from allmydata.util import fileutil
from allmydata.scripts.common import get_aliases
-from allmydata.scripts import cli, runner
from allmydata.test.no_network import GridTestMixin
-from allmydata.util.encodingutil import quote_output, get_io_encoding
from .test_cli import CLITestMixin
from allmydata.scripts import magic_folder_cli
from allmydata.util.fileutil import abspath_expanduser_unicode
-import os, sys, stat, time, json, re
+import os, sys, stat, time
from twisted.trial import unittest
from twisted.internet import defer
-from allmydata.interfaces import IDirectoryNode, NoSuchChildError
+from allmydata.interfaces import IDirectoryNode
from allmydata.util import fake_inotify, fileutil
from allmydata.util.encodingutil import get_filesystem_encoding, to_filepath
from allmydata.test.no_network import GridTestMixin
from allmydata.test.common_util import ReallyEqualMixin, NonASCIIPathMixin
from allmydata.test.common import ShouldFailMixin
-from allmydata.test.test_cli import CLITestMixin
from allmydata.test.test_cli_magic_folder import MagicFolderCLITestMixin
from allmydata.frontends import magic_folder
from allmydata.frontends.magic_folder import MagicFolder
from allmydata import backupdb
from allmydata.util.fileutil import abspath_expanduser_unicode
-from allmydata.util import fileutil
class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqualMixin, NonASCIIPathMixin):
"""
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.files_uploaded'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.directories_created'), 1))
-
+
def _check_move_small_tree(res):
self.mkdir_nonascii(small_tree_dir)
fileutil.write(abspath_expanduser_unicode(u"what", base=small_tree_dir), "say when")
d.addCallback(create_test_file)
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 1))
d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
-
+
def restart(ignore):
tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg")
tahoe_config = fileutil.read(tahoe_config_file)