Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flake8 check to Travis #112

Merged
merged 1 commit into from
Dec 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ python:
services:
- memcached
install: python setup.py install
before_script: pip install nose
script: nosetests
before_script: pip install -r test-requirements.txt
script:
- flake8
- nosetests
12 changes: 6 additions & 6 deletions memcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
from __future__ import print_function

import binascii
import os
import re
import socket
import sys
import threading
import time
import zlib
from io import BytesIO

import six

Expand All @@ -75,7 +75,6 @@ def useOldServerHashFunction():
global serverHashFunction
serverHashFunction = binascii.crc32

from io import BytesIO

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

Expand Down Expand Up @@ -353,7 +352,7 @@ def get_slab_stats(self):
break
item = line.split(' ', 2)
if line.startswith('STAT active_slabs') or line.startswith('STAT total_malloced'):
serverData[item[1]]=item[2]
serverData[item[1]] = item[2]
else:
# 0 = STAT, 1 = ITEM, 2 = Value
slab = item[1].split(':', 2)
Expand Down Expand Up @@ -764,7 +763,8 @@ def cas(self, key, val, time=0, min_compress_len=0, noreply=False):
return self._set("cas", key, val, time, min_compress_len, noreply)

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
-> original key.
"""
Expand Down Expand Up @@ -966,7 +966,7 @@ def _val_to_store_info(self, val, min_compress_len):
val = val.encode('ascii')
# force no attempt to compress this silly string.
min_compress_len = 0
elif six.PY2 and isinstance(val, long):
elif six.PY2 and isinstance(val, long): # noqa: F821
flags |= Client._FLAG_LONG
val = str(val)
if six.PY3:
Expand Down Expand Up @@ -1263,7 +1263,7 @@ def _recv_value(self, server, flags, rlen):
if six.PY3:
val = int(buf)
else:
val = long(buf)
val = long(buf) # noqa: F821
elif flags & Client._FLAG_PICKLE:
try:
file = BytesIO(buf)
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ commands = flake8
commands = nosetests --with-coverage {posargs}

[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