From 972bf22e6d214cbc107e702ba1c156b54ea5a273 Mon Sep 17 00:00:00 2001 From: clowwindy Date: Wed, 27 Aug 2014 00:17:26 +0800 Subject: [PATCH] fix PEP8 --- shadowsocks/asyncdns.py | 4 ++-- shadowsocks/common.py | 3 ++- shadowsocks/encrypt.py | 3 ++- shadowsocks/encrypt_salsa20.py | 5 +++-- shadowsocks/tcprelay.py | 15 ++++++++------- shadowsocks/utils.py | 2 +- tests/test.py | 2 +- tests/test_latency.py | 1 - 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/shadowsocks/asyncdns.py b/shadowsocks/asyncdns.py index f745be7..3cf1625 100644 --- a/shadowsocks/asyncdns.py +++ b/shadowsocks/asyncdns.py @@ -403,8 +403,8 @@ class DNSResolver(object): self._request_id = 1 req = build_request(hostname, qtype, self._request_id) for server in self._servers: - logging.debug('resolving %s with type %d using server %s', hostname, - qtype, server) + logging.debug('resolving %s with type %d using server %s', + hostname, qtype, server) self._sock.sendto(req, (server, 53)) def resolve(self, hostname, callback): diff --git a/shadowsocks/common.py b/shadowsocks/common.py index 7548ff3..6307ea7 100644 --- a/shadowsocks/common.py +++ b/shadowsocks/common.py @@ -126,7 +126,8 @@ def parse_header(data): else: logging.warn('header is too short') else: - logging.warn('unsupported addrtype %d, maybe wrong password' % addrtype) + logging.warn('unsupported addrtype %d, maybe wrong password' % + addrtype) if dest_addr is None: return None return addrtype, dest_addr, dest_port, header_length diff --git a/shadowsocks/encrypt.py b/shadowsocks/encrypt.py index 86c5d6d..952fd72 100644 --- a/shadowsocks/encrypt.py +++ b/shadowsocks/encrypt.py @@ -154,7 +154,8 @@ class Encryptor(object): iv = iv_ iv = iv[:m[1]] if op == 1: - self.cipher_iv = iv[:m[1]] # this iv is for cipher not decipher + # this iv is for cipher not decipher + self.cipher_iv = iv[:m[1]] if method != 'salsa20-ctr': import M2Crypto.EVP return M2Crypto.EVP.Cipher(method.replace('-', '_'), key, iv, diff --git a/shadowsocks/encrypt_salsa20.py b/shadowsocks/encrypt_salsa20.py index 62bca65..823ae65 100644 --- a/shadowsocks/encrypt_salsa20.py +++ b/shadowsocks/encrypt_salsa20.py @@ -67,7 +67,8 @@ class Salsa20Cipher(object): def _next_stream(self): self._nonce &= 0xFFFFFFFFFFFFFFFF self._stream = salsa20.Salsa20_keystream(BLOCK_SIZE, - struct.pack('