Permalink
Browse files

Run flake8 w/ 'E4', fix imports/unused vars

  • Loading branch information...
1 parent be06270 commit 4a62ffc23e4d7fa411a45b0ed1ab69331163f6ce @bitprophet bitprophet committed Aug 22, 2016
View
@@ -6,7 +6,7 @@
import nose
-from fabric.api import abort, local, task
+from fabric.api import task
@task(default=True)
View
@@ -6,6 +6,7 @@
setup.py -- without triggering loads of most of the code. Which doesn't work so
well when you're using setup.py to install e.g. ssh!
"""
+
from fabric.context_managers import (cd, hide, settings, show, path, prefix,
lcd, quiet, warn_only, remote_tunnel, shell_env)
from fabric.decorators import (hosts, roles, runs_once, with_settings, task,
@@ -539,7 +539,7 @@ def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
try:
sock.connect((local_host, local_port))
- except Exception, e:
+ except Exception:
print "[%s] rtunnel: cannot connect to %s:%d (from local)" % (env.host_string, local_host, local_port)
channel.close()
return
@@ -10,7 +10,7 @@
from StringIO import StringIO
from functools import partial
-from fabric.api import *
+from fabric.api import run, sudo, hide, settings, env, put, abort
from fabric.utils import apply_lcwd
View
@@ -46,8 +46,8 @@ def _get_system_username():
except ImportError:
if win32:
import win32api
- import win32security
- import win32profile
+ import win32security # noqa
+ import win32profile # noqa
username = win32api.GetUserName()
return username
@@ -1,7 +1,5 @@
import os
-import types
import re
-import sys
from fabric.api import run, local
from fabric.contrib import files, project
@@ -6,7 +6,7 @@
import shutil
from fabric.api import (
- run, path, put, sudo, abort, warn_only, env, cd, local, settings, get
+ run, path, put, sudo, env, cd, local, settings, get
)
from fabric.contrib.files import exists
@@ -143,7 +143,7 @@ def test_get_with_use_sudo_unowned_file(self):
sudo("chmod 0440 %s" % target)
# Pull down with use_sudo, confirm contents
local_ = StringIO()
- result = get(
+ get(
local_path=local_,
remote_path=target,
use_sudo=True,
@@ -165,7 +165,7 @@ def test_get_with_use_sudo_groupowned_file(self):
sudo("chmod 0640 %s" % target)
# Do eet
local_ = StringIO()
- result = get(
+ get(
local_path=local_,
remote_path=target,
use_sudo=True,
@@ -4,8 +4,6 @@
# Pull in regular tests' utilities
mod = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'tests'))
sys.path.insert(0, mod)
-from mock_streams import mock_streams
-#from utils import FabricTest
# Clean up
del sys.path[0]
View
@@ -0,0 +1,2 @@
+[flake8]
+exclude = tests/support,tests/Python26SocketServer.py,sites,fabric/api.py
@@ -71,7 +71,7 @@ def inner_wrapper(*args, **kwargs):
if stderr:
my_stderr, sys.stderr = sys.stderr, fake_stderr
try:
- ret = func(*args, **kwargs)
+ func(*args, **kwargs)
finally:
if stdout:
sys.stdout = my_stdout
View
@@ -494,7 +494,6 @@ def test_class_based_tasks_are_found_with_proper_name(self):
Wrapped new-style tasks should preserve their function names
"""
module = fabfile('decorated_fabfile_with_classbased_task.py')
- from fabric.state import env
with path_prefix(module):
docs, funcs = load_fabfile(module)
eq_(len(funcs), 1)
@@ -506,7 +505,6 @@ def test_class_based_tasks_are_found_with_variable_name(self):
variable name.
"""
module = fabfile('classbased_task_fabfile.py')
- from fabric.state import env
with path_prefix(module):
docs, funcs = load_fabfile(module)
eq_(len(funcs), 1)
@@ -22,7 +22,6 @@
from fabric.exceptions import CommandTimeout
from fabric.sftp import SFTP
-from fabric.context_managers import settings
from fabric.decorators import with_settings
from utils import (eq_, aborts, assert_contains, eq_contents,
with_patched_input, FabricTest)
@@ -6,14 +6,15 @@
no need to pollute Fab's own test suite. (Yes, if these tests fail, it's likely
that the Fabric tests using the test server may also have issues, but still.)
"""
-__test__ = False
from nose.tools import eq_, ok_
from fabric.network import ssh
from server import FakeSFTPServer
+__test__ = False
+
class AttrHolder(object):
pass
View
@@ -2,7 +2,7 @@
from fudge import Fake, patched_context, with_fakes
import unittest
-from nose.tools import eq_, raises, ok_
+from nose.tools import raises, ok_
import random
import sys
@@ -31,7 +31,7 @@ def test_passes_unused_args_to_parent(self):
def foo(): pass
try:
- task = WrappedCallableTask(foo, *args)
+ WrappedCallableTask(foo, *args)
except TypeError:
msg = "__init__ raised a TypeError, meaning args weren't handled"
self.fail(msg)
@@ -42,20 +42,20 @@ def test_passes_unused_kwargs_to_parent(self):
def foo(): pass
try:
- task = WrappedCallableTask(foo, **kwargs)
+ WrappedCallableTask(foo, **kwargs)
except TypeError:
self.fail(
"__init__ raised a TypeError, meaning kwargs weren't handled")
def test_allows_any_number_of_args(self):
args = [i for i in range(random.randint(0, 10))]
def foo(): pass
- task = WrappedCallableTask(foo, *args)
+ WrappedCallableTask(foo, *args)
def test_allows_any_number_of_kwargs(self):
kwargs = dict([("key%d" % i, i) for i in range(random.randint(0, 10))])
def foo(): pass
- task = WrappedCallableTask(foo, **kwargs)
+ WrappedCallableTask(foo, **kwargs)
def test_run_is_wrapped_callable(self):
def foo(): pass
View
@@ -28,19 +28,19 @@ def test_warn():
def test_indent():
- for description, input, output in (
+ for description, input_, output_ in (
("Sanity check: 1 line string",
'Test', ' Test'),
("List of strings turns in to strings joined by \\n",
["Test", "Test"], ' Test\n Test'),
):
eq_.description = "indent(): %s" % description
- yield eq_, indent(input), output
+ yield eq_, indent(input_), output_
del eq_.description
def test_indent_with_strip():
- for description, input, output in (
+ for description, input_ output_ in (
("Sanity check: 1 line string",
indent('Test', strip=True), ' Test'),
("Check list of strings",
@@ -50,7 +50,7 @@ def test_indent_with_strip():
' Test\n Test'),
):
eq_.description = "indent(strip=True): %s" % description
- yield eq_, input, output
+ yield eq_, input_ output_
del eq_.description
@@ -171,7 +171,6 @@ def test_puts_without_prefix():
puts() shouldn't prefix output with env.host_string if show_prefix is False
"""
s = "my output"
- h = "localhost"
puts(s, show_prefix=False)
eq_(sys.stdout.getvalue(), "%s" % (s + "\n"))

0 comments on commit 4a62ffc

Please sign in to comment.