Skip to content

Commit

Permalink
Fix PEP8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
brianmay committed Apr 30, 2016
1 parent e73e797 commit f3cbc50
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/conf.orig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,7 +55,6 @@
# 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
Expand Down
3 changes: 2 additions & 1 deletion sshuttle/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sshuttle/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def b(s):
def b(s):
return s


def log(s):
global logprefix
try:
Expand Down
6 changes: 3 additions & 3 deletions sshuttle/hostwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions sshuttle/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# Python 2.x
from pipes import quote


def readfile(name):
tokens = name.split(".")
f = None
Expand Down
9 changes: 5 additions & 4 deletions sshuttle/ssnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def next_channel(self):

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):
Expand All @@ -376,7 +376,8 @@ def check_fullness(self):
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)),
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit f3cbc50

Please sign in to comment.