pyflakes warnings
This commit is contained in:
parent
4e0a30ab91
commit
87acfe968e
|
@ -4,7 +4,7 @@ import os.path
|
|||
from collections import deque
|
||||
import time
|
||||
|
||||
from twisted.internet import defer, reactor, task, error
|
||||
from twisted.internet import defer, reactor, task
|
||||
from twisted.python.failure import Failure
|
||||
from twisted.python import runtime
|
||||
from twisted.application import service
|
||||
|
|
|
@ -243,7 +243,7 @@ def _get_json_for_fragment(options, fragment, method='GET', post_args=None):
|
|||
data = resp.read()
|
||||
try:
|
||||
parsed = simplejson.loads(data)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
print "Failed to parse reply:\n%s" % (data,)
|
||||
return []
|
||||
if parsed is None:
|
||||
|
|
|
@ -36,7 +36,7 @@ import sys
|
|||
import time
|
||||
import shutil
|
||||
import subprocess
|
||||
from os.path import join, abspath, curdir, exists, split
|
||||
from os.path import join, abspath, curdir, exists
|
||||
from os import mkdir, listdir, unlink
|
||||
|
||||
is_windows = (sys.platform == 'win32')
|
||||
|
|
|
@ -471,7 +471,7 @@ class MagicFolderAliceBobTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, Rea
|
|||
@defer.inlineCallbacks
|
||||
def test_download_retry(self):
|
||||
alice_fname = os.path.join(self.alice_magic_dir, 'blam')
|
||||
bob_fname = os.path.join(self.bob_magic_dir, 'blam')
|
||||
# bob_fname = os.path.join(self.bob_magic_dir, 'blam')
|
||||
|
||||
# Alice creates a file
|
||||
fileutil.write(alice_fname, ''.join(['contents-%04d\n' % i for i in range(1024)]))
|
||||
|
@ -955,7 +955,7 @@ class SingleMagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, Reall
|
|||
"""
|
||||
|
||||
def setUp(self):
|
||||
x = super(SingleMagicFolderTestMixin, self).setUp()
|
||||
super(SingleMagicFolderTestMixin, self).setUp()
|
||||
temp = self.mktemp()
|
||||
self.basedir = abspath_expanduser_unicode(temp.decode(get_filesystem_encoding()))
|
||||
self.magicfolder = None
|
||||
|
|
|
@ -170,32 +170,6 @@ def is_ancestor_path(parent, dirname):
|
|||
return False
|
||||
return True
|
||||
|
||||
def make_dirs_with_absolute_mode(parent, dirname, mode):
|
||||
"""
|
||||
Make directory `dirname` and chmod it to `mode` afterwards.
|
||||
We chmod all parent directories of `dirname` until we reach
|
||||
`parent`.
|
||||
"""
|
||||
precondition_abspath(parent)
|
||||
precondition_abspath(dirname)
|
||||
if not is_ancestor_path(parent, dirname):
|
||||
raise AssertionError("dirname must be a descendant of parent")
|
||||
|
||||
make_dirs(dirname)
|
||||
while dirname != parent:
|
||||
os.chmod(dirname, mode)
|
||||
# FIXME: doesn't seem to work on Windows for long paths
|
||||
old_dirname, dirname = dirname, os.path.dirname(dirname)
|
||||
_assert(len(dirname) < len(old_dirname), dirname=dirname, old_dirname=old_dirname)
|
||||
|
||||
def is_ancestor_path(parent, dirname):
|
||||
while dirname != parent:
|
||||
# FIXME: doesn't seem to work on Windows for long paths
|
||||
old_dirname, dirname = dirname, os.path.dirname(dirname)
|
||||
if len(dirname) >= len(old_dirname):
|
||||
return False
|
||||
return True
|
||||
|
||||
def make_dirs(dirname, mode=0777):
|
||||
"""
|
||||
An idempotent version of os.makedirs(). If the dir already exists, do
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import simplejson
|
||||
|
||||
from twisted.web.server import UnsupportedMethod
|
||||
|
||||
from nevow import rend
|
||||
from nevow.inevow import IRequest
|
||||
|
||||
from allmydata.web.common import WebError, TokenOnlyWebApi
|
||||
from allmydata.web.common import TokenOnlyWebApi
|
||||
|
||||
|
||||
class MagicFolderWebApi(TokenOnlyWebApi):
|
||||
|
|
|
@ -225,7 +225,7 @@ class INotify(PollMixin):
|
|||
def wait_until_stopped(self):
|
||||
try:
|
||||
fileutil.write(os.path.join(self._path.path, u".ignore-me"), "")
|
||||
except IOError as e:
|
||||
except IOError:
|
||||
pass
|
||||
return self.poll(lambda: self._state == STOPPED)
|
||||
|
||||
|
|
Loading…
Reference in New Issue