Skip to content

Commit ea0cb51

Browse files
authored
Merge pull request linsomniac#112 from timgraham/flake8
Add flake8 check to Travis
2 parents e741b2a + 183e480 commit ea0cb51

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.travis.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ python:
88
services:
99
- memcached
1010
install: python setup.py install
11-
before_script: pip install nose
12-
script: nosetests
11+
before_script: pip install -r test-requirements.txt
12+
script:
13+
- flake8
14+
- nosetests

memcache.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
from __future__ import print_function
4949

5050
import binascii
51-
import os
5251
import re
5352
import socket
5453
import sys
5554
import threading
5655
import time
5756
import zlib
57+
from io import BytesIO
5858

5959
import six
6060

@@ -75,7 +75,6 @@ def useOldServerHashFunction():
7575
global serverHashFunction
7676
serverHashFunction = binascii.crc32
7777

78-
from io import BytesIO
7978

8079
valid_key_chars_re = re.compile(b'[\x21-\x7e\x80-\xff]+$')
8180

@@ -353,7 +352,7 @@ def get_slab_stats(self):
353352
break
354353
item = line.split(' ', 2)
355354
if line.startswith('STAT active_slabs') or line.startswith('STAT total_malloced'):
356-
serverData[item[1]]=item[2]
355+
serverData[item[1]] = item[2]
357356
else:
358357
# 0 = STAT, 1 = ITEM, 2 = Value
359358
slab = item[1].split(':', 2)
@@ -764,7 +763,8 @@ def cas(self, key, val, time=0, min_compress_len=0, noreply=False):
764763
return self._set("cas", key, val, time, min_compress_len, noreply)
765764

766765
def _map_and_prefix_keys(self, key_iterable, key_prefix):
767-
"""Compute the mapping of server (_Host instance) -> list of keys to
766+
"""
767+
Compute the mapping of server (_Host instance) -> list of keys to
768768
stuff onto that server, as well as the mapping of prefixed key
769769
-> original key.
770770
"""
@@ -966,7 +966,7 @@ def _val_to_store_info(self, val, min_compress_len):
966966
val = val.encode('ascii')
967967
# force no attempt to compress this silly string.
968968
min_compress_len = 0
969-
elif six.PY2 and isinstance(val, long):
969+
elif six.PY2 and isinstance(val, long): # noqa: F821
970970
flags |= Client._FLAG_LONG
971971
val = str(val)
972972
if six.PY3:
@@ -1263,7 +1263,7 @@ def _recv_value(self, server, flags, rlen):
12631263
if six.PY3:
12641264
val = int(buf)
12651265
else:
1266-
val = long(buf)
1266+
val = long(buf) # noqa: F821
12671267
elif flags & Client._FLAG_PICKLE:
12681268
try:
12691269
file = BytesIO(buf)

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ commands = flake8
2323
commands = nosetests --with-coverage {posargs}
2424

2525
[flake8]
26-
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv
26+
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv,build
27+
max-line-length = 119

0 commit comments

Comments
 (0)