archrelease: copy trunk to community-x86_64
[ArchLinux/community.git] / shadowsocks / trunk / pycodestyle.patch
blobbde24ecfea20a38e1de318dd5e8adb8cbb03be35
1 commit 0225b05029493d477bde6391f3b0108519783a2e
2 Author: Felix Yan <felixonmars@archlinux.org>
3 Date: Tue Nov 13 02:50:07 2018 +0800
5 Use pycodestyle instead of pep8
7 diff --git a/.travis.yml b/.travis.yml
8 index f11e179..cb02428 100644
9 --- a/.travis.yml
10 +++ b/.travis.yml
11 @@ -13,7 +13,7 @@ before_install:
12 - sudo dd if=/dev/urandom of=/usr/share/nginx/html/file bs=1M count=10
13 - sudo sh -c "echo '127.0.0.1 localhost' > /etc/hosts"
14 - sudo service nginx restart
15 - - pip install pep8 pyflakes nose coverage PySocks
16 + - pip install pycodestyle pyflakes nose coverage PySocks
17 - sudo tests/socksify/install.sh
18 - sudo tests/libsodium/install.sh
19 - sudo tests/libmbedtls/install.sh
20 diff --git a/shadowsocks/common.py b/shadowsocks/common.py
21 index 1a58457..840608f 100644
22 --- a/shadowsocks/common.py
23 +++ b/shadowsocks/common.py
24 @@ -185,8 +185,8 @@ def parse_header(data):
25 addrlen = ord(data[1])
26 if len(data) >= 4 + addrlen:
27 dest_addr = data[2:2 + addrlen]
28 - dest_port = struct.unpack('>H', data[2 + addrlen:4 +
29 - addrlen])[0]
30 + dest_port = struct.unpack('>H', data[2 + addrlen:
31 + 4 + addrlen])[0]
32 header_length = 4 + addrlen
33 else:
34 logging.warn('header is too short')
35 diff --git a/shadowsocks/tcprelay.py b/shadowsocks/tcprelay.py
36 index 0ef913f..423cc80 100644
37 --- a/shadowsocks/tcprelay.py
38 +++ b/shadowsocks/tcprelay.py
39 @@ -519,8 +519,8 @@ class TCPRelayHandler(object):
40 socks_version = common.ord(data[0])
41 nmethods = common.ord(data[1])
42 if socks_version != 5:
43 - logging.warning('unsupported SOCKS protocol version ' +
44 - str(socks_version))
45 + logging.warning('unsupported SOCKS protocol version {}'
46 + .format(socks_version))
47 raise BadSocksHeader
48 if nmethods < 1 or len(data) != nmethods + 2:
49 logging.warning('NMETHODS and number of METHODS mismatch')
50 diff --git a/tests/jenkins.sh b/tests/jenkins.sh
51 index 85dd01a..4288336 100755
52 --- a/tests/jenkins.sh
53 +++ b/tests/jenkins.sh
54 @@ -27,7 +27,7 @@ function run_test {
55 python --version
56 coverage erase
57 mkdir tmp
58 -run_test pep8 --ignore=E402 .
59 +run_test pycodestyle --ignore=E402,E305,E741 .
60 run_test pyflakes .
61 run_test coverage run tests/nose_plugin.py -v
62 run_test python setup.py sdist