Merge branch 'flake8' of https://github.com/sontek/pymemcache into switch_to_pytest
Conflicts: setup.cfg setup.py tox.ini
This commit is contained in:
@@ -128,9 +128,9 @@ class Client(object):
|
|||||||
strings must be encoded (as UTF-8, for example) unless they consist only
|
strings must be encoded (as UTF-8, for example) unless they consist only
|
||||||
of ASCII characters that are neither whitespace nor control characters.
|
of ASCII characters that are neither whitespace nor control characters.
|
||||||
|
|
||||||
Values must have a __str__() method to convert themselves to a byte string.
|
Values must have a __str__() method to convert themselves to a byte
|
||||||
Unicode objects can be a problem since str() on a Unicode object will
|
string. Unicode objects can be a problem since str() on a Unicode object
|
||||||
attempt to encode it as ASCII (which will fail if the value contains
|
will attempt to encode it as ASCII (which will fail if the value contains
|
||||||
code points larger than U+127). You can fix this will a serializer or by
|
code points larger than U+127). You can fix this will a serializer or by
|
||||||
just calling encode on the string (using UTF-8, for instance).
|
just calling encode on the string (using UTF-8, for instance).
|
||||||
|
|
||||||
@@ -602,7 +602,8 @@ class Client(object):
|
|||||||
Args:
|
Args:
|
||||||
delay: optional int, the number of seconds to wait before flushing,
|
delay: optional int, the number of seconds to wait before flushing,
|
||||||
or zero to flush immediately (the default).
|
or zero to flush immediately (the default).
|
||||||
noreply: optional bool, True to not wait for the response (the default).
|
noreply: optional bool, True to not wait for the response
|
||||||
|
(the default).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
True.
|
True.
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ Best Practices:
|
|||||||
old cluster before you switch away from FallbackClient.
|
old cluster before you switch away from FallbackClient.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class FallbackClient(object):
|
class FallbackClient(object):
|
||||||
def __init__(self, caches):
|
def __init__(self, caches):
|
||||||
assert len(caches) > 0
|
assert len(caches) > 0
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ except ImportError:
|
|||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
|
|
||||||
|
|
||||||
FLAG_PICKLE = 1<<0
|
FLAG_PICKLE = 1 << 0
|
||||||
FLAG_INTEGER = 1<<1
|
FLAG_INTEGER = 1 << 1
|
||||||
FLAG_LONG = 1<<2
|
FLAG_LONG = 1 << 2
|
||||||
|
|
||||||
|
|
||||||
def python_memcache_serializer(key, value):
|
def python_memcache_serializer(key, value):
|
||||||
@@ -46,6 +46,7 @@ def python_memcache_serializer(key, value):
|
|||||||
|
|
||||||
return value, flags
|
return value, flags
|
||||||
|
|
||||||
|
|
||||||
def python_memcache_deserializer(key, value, flags):
|
def python_memcache_deserializer(key, value, flags):
|
||||||
if flags == 0:
|
if flags == 0:
|
||||||
return value
|
return value
|
||||||
@@ -61,7 +62,7 @@ def python_memcache_deserializer(key, value, flags):
|
|||||||
buf = StringIO(value)
|
buf = StringIO(value)
|
||||||
unpickler = pickle.Unpickler(buf)
|
unpickler = pickle.Unpickler(buf)
|
||||||
return unpickler.load()
|
return unpickler.load()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
logging.info('Pickle error', exc_info=True)
|
logging.info('Pickle error', exc_info=True)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@@ -16,3 +16,7 @@ addopts =
|
|||||||
markers =
|
markers =
|
||||||
unit
|
unit
|
||||||
integration
|
integration
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
exclude = pymemcache/test/
|
||||||
|
show-source = True
|
||||||
|
|||||||
22
setup.py
22
setup.py
@@ -5,17 +5,17 @@ from setuptools import setup, find_packages
|
|||||||
from pymemcache import __version__
|
from pymemcache import __version__
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'pymemcache',
|
name='pymemcache',
|
||||||
version = __version__,
|
version=__version__,
|
||||||
author = 'Charles Gordon',
|
author='Charles Gordon',
|
||||||
author_email = 'charles@pinterest.com',
|
author_email='charles@pinterest.com',
|
||||||
packages = find_packages(),
|
packages=find_packages(),
|
||||||
install_requires = ['six'],
|
install_requires=['six'],
|
||||||
description = 'A comprehensive, fast, pure Python memcached client',
|
description='A comprehensive, fast, pure Python memcached client',
|
||||||
long_description = open('README.md').read(),
|
long_description=open('README.md').read(),
|
||||||
license = 'Apache License 2.0',
|
license='Apache License 2.0',
|
||||||
url = 'https://github.com/Pinterest/pymemcache',
|
url='https://github.com/Pinterest/pymemcache',
|
||||||
classifiers = [
|
classifiers=[
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
'Programming Language :: Python :: 2.6',
|
'Programming Language :: Python :: 2.6',
|
||||||
'Programming Language :: Python :: 2.7',
|
'Programming Language :: Python :: 2.7',
|
||||||
|
|||||||
7
tox.ini
7
tox.ini
@@ -1,5 +1,5 @@
|
|||||||
[tox]
|
[tox]
|
||||||
envlist = py26, py27, pypy, py33, py34, docs
|
envlist = py26, py27, pypy, py33, py34, docs, flake8
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
commands =
|
commands =
|
||||||
@@ -7,6 +7,11 @@ commands =
|
|||||||
pip install -e .
|
pip install -e .
|
||||||
py.test {posargs}
|
py.test {posargs}
|
||||||
|
|
||||||
|
[testenv:flake8]
|
||||||
|
commands =
|
||||||
|
pip install flake8
|
||||||
|
flake8 .
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
commands =
|
commands =
|
||||||
pip install -r docs-requirements.txt
|
pip install -r docs-requirements.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user