Merge pull request #112 from timgraham/flake8
Add flake8 check to Travis
This commit is contained in:
@@ -8,5 +8,7 @@ python:
|
|||||||
services:
|
services:
|
||||||
- memcached
|
- memcached
|
||||||
install: python setup.py install
|
install: python setup.py install
|
||||||
before_script: pip install nose
|
before_script: pip install -r test-requirements.txt
|
||||||
script: nosetests
|
script:
|
||||||
|
- flake8
|
||||||
|
- nosetests
|
||||||
|
|||||||
12
memcache.py
12
memcache.py
@@ -48,13 +48,13 @@ More detailed documentation is available in the L{Client} class.
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import binascii
|
import binascii
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import zlib
|
import zlib
|
||||||
|
from io import BytesIO
|
||||||
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
@@ -75,7 +75,6 @@ def useOldServerHashFunction():
|
|||||||
global serverHashFunction
|
global serverHashFunction
|
||||||
serverHashFunction = binascii.crc32
|
serverHashFunction = binascii.crc32
|
||||||
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
valid_key_chars_re = re.compile(b'[\x21-\x7e\x80-\xff]+$')
|
valid_key_chars_re = re.compile(b'[\x21-\x7e\x80-\xff]+$')
|
||||||
|
|
||||||
@@ -353,7 +352,7 @@ class Client(threading.local):
|
|||||||
break
|
break
|
||||||
item = line.split(' ', 2)
|
item = line.split(' ', 2)
|
||||||
if line.startswith('STAT active_slabs') or line.startswith('STAT total_malloced'):
|
if line.startswith('STAT active_slabs') or line.startswith('STAT total_malloced'):
|
||||||
serverData[item[1]]=item[2]
|
serverData[item[1]] = item[2]
|
||||||
else:
|
else:
|
||||||
# 0 = STAT, 1 = ITEM, 2 = Value
|
# 0 = STAT, 1 = ITEM, 2 = Value
|
||||||
slab = item[1].split(':', 2)
|
slab = item[1].split(':', 2)
|
||||||
@@ -764,7 +763,8 @@ class Client(threading.local):
|
|||||||
return self._set("cas", key, val, time, min_compress_len, noreply)
|
return self._set("cas", key, val, time, min_compress_len, noreply)
|
||||||
|
|
||||||
def _map_and_prefix_keys(self, key_iterable, key_prefix):
|
def _map_and_prefix_keys(self, key_iterable, key_prefix):
|
||||||
"""Compute the mapping of server (_Host instance) -> list of keys to
|
"""
|
||||||
|
Compute the mapping of server (_Host instance) -> list of keys to
|
||||||
stuff onto that server, as well as the mapping of prefixed key
|
stuff onto that server, as well as the mapping of prefixed key
|
||||||
-> original key.
|
-> original key.
|
||||||
"""
|
"""
|
||||||
@@ -966,7 +966,7 @@ class Client(threading.local):
|
|||||||
val = val.encode('ascii')
|
val = val.encode('ascii')
|
||||||
# force no attempt to compress this silly string.
|
# force no attempt to compress this silly string.
|
||||||
min_compress_len = 0
|
min_compress_len = 0
|
||||||
elif six.PY2 and isinstance(val, long):
|
elif six.PY2 and isinstance(val, long): # noqa: F821
|
||||||
flags |= Client._FLAG_LONG
|
flags |= Client._FLAG_LONG
|
||||||
val = str(val)
|
val = str(val)
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
@@ -1263,7 +1263,7 @@ class Client(threading.local):
|
|||||||
if six.PY3:
|
if six.PY3:
|
||||||
val = int(buf)
|
val = int(buf)
|
||||||
else:
|
else:
|
||||||
val = long(buf)
|
val = long(buf) # noqa: F821
|
||||||
elif flags & Client._FLAG_PICKLE:
|
elif flags & Client._FLAG_PICKLE:
|
||||||
try:
|
try:
|
||||||
file = BytesIO(buf)
|
file = BytesIO(buf)
|
||||||
|
|||||||
3
tox.ini
3
tox.ini
@@ -23,4 +23,5 @@ commands = flake8
|
|||||||
commands = nosetests --with-coverage {posargs}
|
commands = nosetests --with-coverage {posargs}
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv
|
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv,build
|
||||||
|
max-line-length = 119
|
||||||
|
|||||||
Reference in New Issue
Block a user