summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2016-04-30 18:08:46 +1000
committerBrian May <brian@linuxpenguins.xyz>2016-04-30 18:08:46 +1000
commitf3cbc5018a2d04ab68c0ef040e83acac5392342d (patch)
tree9a6c607c4230c22c1444bedc38a090cafd1462b3
parente73e797f334e18505b1d60430fe36e52ce4b52e0 (diff)
Fix PEP8 issues
-rw-r--r--docs/conf.orig.py2
-rw-r--r--sshuttle/cmdline.py3
-rw-r--r--sshuttle/helpers.py1
-rw-r--r--sshuttle/hostwatch.py6
-rw-r--r--sshuttle/ssh.py1
-rw-r--r--sshuttle/ssnet.py9
6 files changed, 13 insertions, 9 deletions
diff --git a/docs/conf.orig.py b/docs/conf.orig.py
index 9fc0be6..5115570 100644
--- a/docs/conf.orig.py
+++ b/docs/conf.orig.py
@@ -15,6 +15,7 @@
# import sys
# import os
+from setuptools_scm import get_version
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -54,7 +55,6 @@ copyright = '2016, Brian May'
# built documents.
#
# The short X.Y version.
-from setuptools_scm import get_version
version = get_version(root="..")
# The full version, including alpha/beta/rc tags.
release = version
diff --git a/sshuttle/cmdline.py b/sshuttle/cmdline.py
index 3f0dfb4..f5171ac 100644
--- a/sshuttle/cmdline.py
+++ b/sshuttle/cmdline.py
@@ -29,7 +29,8 @@ def main():
includes = opt.subnets
excludes = opt.exclude
if not includes and not opt.auto_nets:
- parser.error('at least one subnet, subnet file, or -N expected')
+ parser.error('at least one subnet, subnet file, '
+ 'or -N expected')
remotename = opt.remote
if remotename == '' or remotename == '-':
remotename = None
diff --git a/sshuttle/helpers.py b/sshuttle/helpers.py
index 67a6013..d3570f0 100644
--- a/sshuttle/helpers.py
+++ b/sshuttle/helpers.py
@@ -16,6 +16,7 @@ else:
def b(s):
return s
+
def log(s):
global logprefix
try:
diff --git a/sshuttle/hostwatch.py b/sshuttle/hostwatch.py
index be210f9..5dede13 100644
--- a/sshuttle/hostwatch.py
+++ b/sshuttle/hostwatch.py
@@ -39,7 +39,7 @@ def write_host_cache():
for name, ip in sorted(hostnames.items()):
f.write(('%s,%s\n' % (name, ip)).encode("ASCII"))
f.close()
- os.chmod(tmpname, 384) # 600 in octal, 'rw-------'
+ os.chmod(tmpname, 384) # 600 in octal, 'rw-------'
os.rename(tmpname, CACHEFILE)
finally:
try:
@@ -70,8 +70,8 @@ def read_host_cache():
def found_host(hostname, ip):
hostname = re.sub(r'\..*', '', hostname)
hostname = re.sub(r'[^-\w]', '_', hostname)
- if (ip.startswith('127.') or ip.startswith('255.')
- or hostname == 'localhost'):
+ if (ip.startswith('127.') or ip.startswith('255.') or
+ hostname == 'localhost'):
return
oldip = hostnames.get(hostname)
if oldip != ip:
diff --git a/sshuttle/ssh.py b/sshuttle/ssh.py
index bfdff81..3214bda 100644
--- a/sshuttle/ssh.py
+++ b/sshuttle/ssh.py
@@ -15,6 +15,7 @@ except ImportError:
# Python 2.x
from pipes import quote
+
def readfile(name):
tokens = name.split(".")
f = None
diff --git a/sshuttle/ssnet.py b/sshuttle/ssnet.py
index 61b3e5c..9d319d2 100644
--- a/sshuttle/ssnet.py
+++ b/sshuttle/ssnet.py
@@ -358,8 +358,8 @@ class Mux(Handler):
def amount_queued(self):
total = 0
- for b in self.outbuf:
- total += len(b)
+ for byte in self.outbuf:
+ total += len(byte)
return total
def check_fullness(self):
@@ -376,7 +376,8 @@ class Mux(Handler):
def send(self, channel, cmd, data):
assert isinstance(data, binary_type)
assert len(data) <= 65535
- p = struct.pack('!ccHHH', b('S'), b('S'), channel, cmd, len(data)) + data
+ p = struct.pack('!ccHHH', b('S'), b('S'), channel, cmd, len(data)) \
+ + data
self.outbuf.append(p)
debug2(' > channel=%d cmd=%s len=%d (fullness=%d)\n'
% (channel, cmd_to_name.get(cmd, hex(cmd)),
@@ -557,7 +558,7 @@ def connect_dst(family, ip, port):
outsock.setsockopt(socket.SOL_IP, socket.IP_TTL, 42)
return SockWrapper(outsock, outsock,
connect_to=(ip, port),
- peername = '%s:%d' % (ip, port))
+ peername='%s:%d' % (ip, port))
def runonce(handlers, mux):