🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

python-memcached

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-memcached - pypi Package Compare versions

Comparing version
1.54
to
1.56
+1
python_memcached.egg-info/dependency_links.txt
Metadata-Version: 1.1
Name: python-memcached
Version: 1.56
Summary: Pure python memcached client
Home-page: http://www.tummy.com/Community/software/python-memcached/
Author: Sean Reifschneider
Author-email: jafo@tummy.com
License: UNKNOWN
Download-URL: ftp://ftp.tummy.com/pub/python-memcached/
Description: [![Build
Status](https://travis-ci.org/linsomniac/python-memcached.svg)](https://travis-ci.org/linsomniac/python-memcached)
## Overview
This software is a 100% Python interface to the memcached memory cache
daemon. It is the client side software which allows storing values
in one or more, possibly remote, memcached servers. Search google for
memcached for more information.
This package was originally written by Evan Martin of Danga. Please do
not contact Evan about maintenance. Sean Reifschneider of tummy.com,
ltd. has taken over maintenance of it.
Please report issues and submit code changes to the github repository at:
https://github.com/linsomniac/python-memcached
For changes prior to 2013-03-26, see the old Launchpad repository at:
Historic issues: https://launchpad.net/python-memcached
## Testing
Test patches locally and easily by running tox:
pip install tox
tox -e py27
Test for style by running tox:
tox -e pep8
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
six
ChangeLog
MANIFEST.in
README.md
memcache.py
requirements.txt
setup.cfg
setup.py
test-requirements.txt
python_memcached.egg-info/PKG-INFO
python_memcached.egg-info/SOURCES.txt
python_memcached.egg-info/dependency_links.txt
python_memcached.egg-info/requires.txt
python_memcached.egg-info/top_level.txt
+268
-139

@@ -65,3 +65,3 @@ #!/usr/bin/env python

return (
(((binascii.crc32(key.encode('ascii')) & 0xffffffff)
(((binascii.crc32(key) & 0xffffffff)
>> 16) & 0x7fff) or 1)

@@ -76,28 +76,16 @@ serverHashFunction = cmemcache_hash

try:
from zlib import compress, decompress
_supports_compress = True
except ImportError:
_supports_compress = False
# quickly define a decompress just in case we recv compressed data.
def decompress(val):
raise _Error(
"Received compressed data but I don't support "
"compression (import error)")
from io import BytesIO
try:
unicode
except NameError:
_has_unicode = False
if six.PY2:
try:
unicode
except NameError:
_has_unicode = False
else:
_has_unicode = True
else:
_has_unicode = True
try:
_str_cls = basestring
except NameError:
_str_cls = str
_str_cls = six.string_types
valid_key_chars_re = re.compile('[\x21-\x7e\x80-\xff]+$')
valid_key_chars_re = re.compile(b'[\x21-\x7e\x80-\xff]+$')

@@ -107,3 +95,3 @@

__author__ = "Sean Reifschneider <jafo-memcached@tummy.com>"
__version__ = "1.54"
__version__ = "1.56"
__copyright__ = "Copyright (C) 2003 Danga Interactive"

@@ -114,5 +102,6 @@ # http://en.wikipedia.org/wiki/Python_Software_Foundation_License

SERVER_MAX_KEY_LENGTH = 250
# Storing values larger than 1MB requires recompiling memcached. If
# you do, this value can be changed by doing
# "memcache.SERVER_MAX_VALUE_LENGTH = N" after importing this module.
# Storing values larger than 1MB requires starting memcached with -I <size> for
# memcached >= 1.4.2 or recompiling for < 1.4.2. If you do, this value can be
# changed by doing "memcache.SERVER_MAX_VALUE_LENGTH = N" after importing this
# module.
SERVER_MAX_VALUE_LENGTH = 1024 * 1024

@@ -185,2 +174,3 @@

pickler=pickle.Pickler, unpickler=pickle.Unpickler,
compressor=zlib.compress, decompressor=zlib.decompress,
pload=None, pid=None,

@@ -248,2 +238,4 @@ server_max_key_length=None, server_max_value_length=None,

self.unpickler = unpickler
self.compressor = compressor
self.decompressor = decompressor
self.persistent_load = pload

@@ -266,2 +258,28 @@ self.persistent_id = pid

def _encode_key(self, key):
if isinstance(key, tuple):
if isinstance(key[1], six.text_type):
return (key[0], key[1].encode('utf8'))
elif isinstance(key, six.text_type):
return key.encode('utf8')
return key
def _encode_cmd(self, cmd, key, headers, noreply, *args):
cmd_bytes = cmd.encode() if six.PY3 else cmd
fullcmd = [cmd_bytes, b' ', key]
if headers:
if six.PY3:
headers = headers.encode()
fullcmd.append(b' ')
fullcmd.append(headers)
if noreply:
fullcmd.append(b' noreply')
if args:
fullcmd.append(b' ')
fullcmd.extend(args)
return b''.join(fullcmd)
def reset_cas(self):

@@ -409,3 +427,3 @@ """Reset the cas cache.

def delete_multi(self, keys, time=0, key_prefix=''):
def delete_multi(self, keys, time=0, key_prefix='', noreply=False):
"""Delete multiple keys in the memcache doing just one query.

@@ -431,2 +449,4 @@

L{set_multi}.
@param noreply: optional parameter instructs the server to not send the
reply.
@return: 1 if no failure in communication with any memcacheds.

@@ -448,8 +468,9 @@ @rtype: int

write = bigcmd.append
extra = ' noreply' if noreply else ''
if time is not None:
for key in server_keys[server]: # These are mangled keys
write("delete %s %d\r\n" % (key, time))
write("delete %s %d%s\r\n" % (key, time, extra))
else:
for key in server_keys[server]: # These are mangled keys
write("delete %s\r\n" % key)
write("delete %s%s\r\n" % (key, extra))
try:

@@ -464,2 +485,6 @@ server.send_cmds(''.join(bigcmd))

# if noreply, just return
if noreply:
return rc
# if any servers died on the way, don't expect them to respond.

@@ -480,3 +505,3 @@ for server in dead_servers:

def delete(self, key, time=0):
def delete(self, key, time=0, noreply=False):
'''Deletes a key from the memcache.

@@ -487,7 +512,10 @@

should fail. Defaults to None for no delay.
@param noreply: optional parameter instructs the server to not send the
reply.
@rtype: int
'''
return self._deletetouch(['DELETED', 'NOT_FOUND'], "delete", key, time)
return self._deletetouch([b'DELETED', b'NOT_FOUND'], "delete", key,
time, noreply)
def touch(self, key, time=0):
def touch(self, key, time=0, noreply=False):
'''Updates the expiration time of a key in memcache.

@@ -501,7 +529,10 @@

default to 0 == cache forever.
@param noreply: optional parameter instructs the server to not send the
reply.
@rtype: int
'''
return self._deletetouch(['TOUCHED'], "touch", key, time)
return self._deletetouch([b'TOUCHED'], "touch", key, time, noreply)
def _deletetouch(self, expected, cmd, key, time=0):
def _deletetouch(self, expected, cmd, key, time=0, noreply=False):
key = self._encode_key(key)
if self.do_check_key:

@@ -514,8 +545,10 @@ self.check_key(key)

if time is not None and time != 0:
cmd = "%s %s %d" % (cmd, key, time)
fullcmd = self._encode_cmd(cmd, key, str(time), noreply)
else:
cmd = "%s %s" % (cmd, key)
fullcmd = self._encode_cmd(cmd, key, None, noreply)
try:
server.send_cmd(cmd)
server.send_cmd(fullcmd)
if noreply:
return 1
line = server.readline()

@@ -532,3 +565,3 @@ if line and line.strip() in expected:

def incr(self, key, delta=1):
def incr(self, key, delta=1, noreply=False):
"""Increment value for C{key} by C{delta}

@@ -558,8 +591,11 @@

@return: New value after incrementing.
@param noreply: optional parameter instructs the server to not send the
reply.
@return: New value after incrementing, no None for noreply or error.
@rtype: int
"""
return self._incrdecr("incr", key, delta)
return self._incrdecr("incr", key, delta, noreply)
def decr(self, key, delta=1):
def decr(self, key, delta=1, noreply=False):
"""Decrement value for C{key} by C{delta}

@@ -574,8 +610,12 @@

@return: New value after decrementing or None on error.
@param noreply: optional parameter instructs the server to not send the
reply.
@return: New value after decrementing, or None for noreply or error.
@rtype: int
"""
return self._incrdecr("decr", key, delta)
return self._incrdecr("decr", key, delta, noreply)
def _incrdecr(self, cmd, key, delta):
def _incrdecr(self, cmd, key, delta, noreply=False):
key = self._encode_key(key)
if self.do_check_key:

@@ -587,7 +627,9 @@ self.check_key(key)

self._statlog(cmd)
cmd = "%s %s %d" % (cmd, key, delta)
fullcmd = self._encode_cmd(cmd, key, str(delta), noreply)
try:
server.send_cmd(cmd)
server.send_cmd(fullcmd)
if noreply:
return
line = server.readline()
if line is None or line.strip() == 'NOT_FOUND':
if line is None or line.strip() == b'NOT_FOUND':
return None

@@ -601,3 +643,3 @@ return int(line)

def add(self, key, val, time=0, min_compress_len=0):
def add(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Add new key with value.

@@ -611,5 +653,5 @@

'''
return self._set("add", key, val, time, min_compress_len)
return self._set("add", key, val, time, min_compress_len, noreply)
def append(self, key, val, time=0, min_compress_len=0):
def append(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Append the value to the end of the existing key's value.

@@ -623,5 +665,5 @@

'''
return self._set("append", key, val, time, min_compress_len)
return self._set("append", key, val, time, min_compress_len, noreply)
def prepend(self, key, val, time=0, min_compress_len=0):
def prepend(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Prepend the value to the beginning of the existing key's value.

@@ -635,5 +677,5 @@

'''
return self._set("prepend", key, val, time, min_compress_len)
return self._set("prepend", key, val, time, min_compress_len, noreply)
def replace(self, key, val, time=0, min_compress_len=0):
def replace(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Replace existing key with value.

@@ -647,5 +689,5 @@

'''
return self._set("replace", key, val, time, min_compress_len)
return self._set("replace", key, val, time, min_compress_len, noreply)
def set(self, key, val, time=0, min_compress_len=0):
def set(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Unconditionally sets a key to a given value in the memcache.

@@ -670,3 +712,3 @@

@param min_compress_len: The threshold length to kick in
auto-compression of the value using the zlib.compress()
auto-compression of the value using the compressor
routine. If the value being cached is a string, then the

@@ -680,6 +722,8 @@ length of the string is measured, else if the value is an

@param noreply: optional parameter instructs the server to not
send the reply.
'''
return self._set("set", key, val, time, min_compress_len)
return self._set("set", key, val, time, min_compress_len, noreply)
def cas(self, key, val, time=0, min_compress_len=0):
def cas(self, key, val, time=0, min_compress_len=0, noreply=False):
'''Check and set (CAS)

@@ -707,3 +751,3 @@

@param min_compress_len: The threshold length to kick in
auto-compression of the value using the zlib.compress()
auto-compression of the value using the compressor
routine. If the value being cached is a string, then the

@@ -716,4 +760,7 @@ length of the string is measured, else if the value is an

ever try to compress.
@param noreply: optional parameter instructs the server to not
send the reply.
'''
return self._set("cas", key, val, time, min_compress_len)
return self._set("cas", key, val, time, min_compress_len, noreply)

@@ -725,2 +772,3 @@ def _map_and_prefix_keys(self, key_iterable, key_prefix):

"""
key_prefix = self._encode_key(key_prefix)
# Check it just once ...

@@ -741,16 +789,35 @@ key_extra_len = len(key_prefix)

# Ensure call to _get_server gets a Tuple as well.
str_orig_key = str(orig_key[1])
serverhash, key = orig_key
key = self._encode_key(key)
if not isinstance(key, six.binary_type):
# set_multi supports int / long keys.
key = str(key)
if six.PY3:
key = key.encode('utf8')
bytes_orig_key = key
# Gotta pre-mangle key before hashing to a
# server. Returns the mangled key.
server, key = self._get_server(
(orig_key[0], key_prefix + str_orig_key))
(serverhash, key_prefix + key))
orig_key = orig_key[1]
else:
# set_multi supports int / long keys.
str_orig_key = str(orig_key)
server, key = self._get_server(key_prefix + str_orig_key)
key = self._encode_key(orig_key)
if not isinstance(key, six.binary_type):
# set_multi supports int / long keys.
key = str(key)
if six.PY3:
key = key.encode('utf8')
bytes_orig_key = key
server, key = self._get_server(key_prefix + key)
# alert when passed in key is None
if orig_key is None:
self.check_key(orig_key, key_extra_len=key_extra_len)
# Now check to make sure key length is proper ...
if self.do_check_key:
self.check_key(str_orig_key, key_extra_len=key_extra_len)
self.check_key(bytes_orig_key, key_extra_len=key_extra_len)

@@ -767,3 +834,4 @@ if not server:

def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0):
def set_multi(self, mapping, time=0, key_prefix='', min_compress_len=0,
noreply=False):
'''Sets multiple keys in the memcache doing just one query.

@@ -811,3 +879,3 @@

@param min_compress_len: The threshold length to kick in
auto-compression of the value using the zlib.compress()
auto-compression of the value using the compressor
routine. If the value being cached is a string, then the

@@ -821,2 +889,5 @@ length of the string is measured, else if the value is an

@param noreply: optional parameter instructs the server to not
send the reply.
@return: List of keys which failed to be stored [ memcache out

@@ -845,11 +916,11 @@ of memory, etc. ].

if store_info:
msg = "set %s %d %d %d\r\n%s\r\n"
write(msg % (key,
store_info[0],
time,
store_info[1],
store_info[2]))
flags, len_val, val = store_info
headers = "%d %d %d" % (flags, time, len_val)
fullcmd = self._encode_cmd('set', key, headers,
noreply,
b'\r\n', val, b'\r\n')
write(fullcmd)
else:
notstored.append(prefixed_to_orig_key[key])
server.send_cmds(''.join(bigcmd))
server.send_cmds(b''.join(bigcmd))
except socket.error as msg:

@@ -861,2 +932,6 @@ if isinstance(msg, tuple):

# if noreply, just return early
if noreply:
return notstored
# if any servers died on the way, don't expect them to respond.

@@ -891,12 +966,18 @@ for server in dead_servers:

flags = 0
if isinstance(val, str):
if isinstance(val, six.binary_type):
pass
elif isinstance(val, six.text_type):
val = val.encode('utf-8')
elif isinstance(val, int):
flags |= Client._FLAG_INTEGER
val = "%d" % val
val = str(val)
if six.PY3:
val = val.encode('ascii')
# force no attempt to compress this silly string.
min_compress_len = 0
elif isinstance(val, long):
elif six.PY2 and isinstance(val, long):
flags |= Client._FLAG_LONG
val = "%d" % val
val = str(val)
if six.PY3:
val = val.encode('ascii')
# force no attempt to compress this silly string.

@@ -917,7 +998,6 @@ min_compress_len = 0

lv = len(val)
# We should try to compress if min_compress_len > 0 and we
# could import zlib and this string is longer than our min
# threshold.
# We should try to compress if min_compress_len > 0
# and this string is longer than our min threshold.
if min_compress_len and lv > min_compress_len:
comp_val = zlib.compress(val)
comp_val = self.compressor(val)
# Only retain the result if the compression result is smaller

@@ -936,3 +1016,4 @@ # than the original.

def _set(self, cmd, key, val, time, min_compress_len=0):
def _set(self, cmd, key, val, time, min_compress_len=0, noreply=False):
key = self._encode_key(key)
if self.do_check_key:

@@ -947,22 +1028,25 @@ self.check_key(key)

if cmd == 'cas' and key not in self.cas_ids:
return self._set('set', key, val, time, min_compress_len,
noreply)
store_info = self._val_to_store_info(val, min_compress_len)
if not store_info:
return(0)
flags, len_val, encoded_val = store_info
if cmd == 'cas':
if key not in self.cas_ids:
return self._set('set', key, val, time, min_compress_len)
fullcmd = "%s %s %d %d %d %d\r\n%s" % (
cmd, key, store_info[0], time, store_info[1],
self.cas_ids[key], store_info[2])
headers = ("%d %d %d %d"
% (flags, time, len_val, self.cas_ids[key]))
else:
fullcmd = "%s %s %d %d %d\r\n%s" % (
cmd, key, store_info[0],
time, store_info[1], store_info[2]
)
headers = "%d %d %d" % (flags, time, len_val)
fullcmd = self._encode_cmd(cmd, key, headers, noreply,
b'\r\n', encoded_val)
try:
server.send_cmd(fullcmd)
return(server.expect("STORED", raise_exception=True)
== "STORED")
if noreply:
return True
return(server.expect(b"STORED", raise_exception=True)
== b"STORED")
except socket.error as msg:

@@ -986,2 +1070,3 @@ if isinstance(msg, tuple):

def _get(self, cmd, key):
key = self._encode_key(key)
if self.do_check_key:

@@ -997,3 +1082,5 @@ self.check_key(key)

try:
server.send_cmd("%s %s" % (cmd, key))
cmd_bytes = cmd.encode() if six.PY3 else cmd
fullcmd = b''.join((cmd_bytes, b' ', key))
server.send_cmd(fullcmd)
rkey = flags = rlen = cas_id = None

@@ -1017,3 +1104,3 @@

finally:
server.expect("END", raise_exception=True)
server.expect(b"END", raise_exception=True)
except (_Error, socket.error) as msg:

@@ -1117,3 +1204,4 @@ if isinstance(msg, tuple):

try:
server.send_cmd("get %s" % " ".join(server_keys[server]))
fullcmd = b"get " + b" ".join(server_keys[server])
server.send_cmd(fullcmd)
except socket.error as msg:

@@ -1133,3 +1221,3 @@ if isinstance(msg, tuple):

line = server.readline()
while line and line != 'END':
while line and line != b'END':
rkey, flags, rlen = self._expectvalue(server, line)

@@ -1152,3 +1240,3 @@ # Bo Yang reports that this can sometimes be None

if line and line[:5] == 'VALUE':
if line and line[:5] == b'VALUE':
resp, rkey, flags, len, cas_id = line.split()

@@ -1163,3 +1251,3 @@ return (rkey, int(flags), int(len), int(cas_id))

if line and line[:5] == 'VALUE':
if line and line[:5] == b'VALUE':
resp, rkey, flags, len = line.split()

@@ -1183,11 +1271,18 @@ flags = int(flags)

if flags & Client._FLAG_COMPRESSED:
buf = zlib.decompress(buf)
buf = self.decompressor(buf)
flags &= ~Client._FLAG_COMPRESSED
if flags == 0 or flags == Client._FLAG_COMPRESSED:
# Either a bare string or a compressed string now decompressed...
val = buf
if flags == 0:
# Bare string
if six.PY3:
val = buf.decode('utf8')
else:
val = buf
elif flags & Client._FLAG_INTEGER:
val = int(buf)
elif flags & Client._FLAG_LONG:
val = long(buf)
if six.PY3:
val = int(buf)
else:
val = long(buf)
elif flags & Client._FLAG_PICKLE:

@@ -1223,25 +1318,24 @@ try:

key = key[1]
if not key:
if key is None:
raise Client.MemcachedKeyNoneError("Key is None")
if key is '':
if key_extra_len is 0:
raise Client.MemcachedKeyNoneError("Key is empty")
# Make sure we're not a specific unicode type, if we're old enough that
# it's a separate type.
if _has_unicode is True and isinstance(key, unicode):
raise Client.MemcachedStringEncodingError(
"Keys must be str()'s, not unicode. Convert your unicode "
"strings using mystring.encode(charset)!")
if not isinstance(key, str):
raise Client.MemcachedKeyTypeError("Key must be str()'s")
# key is empty but there is some other component to key
return
if isinstance(key, _str_cls):
if (self.server_max_key_length != 0 and
len(key) + key_extra_len > self.server_max_key_length):
raise Client.MemcachedKeyLengthError(
"Key length is > %s" % self.server_max_key_length
)
if not valid_key_chars_re.match(key):
raise Client.MemcachedKeyCharacterError(
"Control/space characters not allowed (key=%r)" % key)
if not isinstance(key, six.binary_type):
raise Client.MemcachedKeyTypeError("Key must be a binary string")
if (self.server_max_key_length != 0 and
len(key) + key_extra_len > self.server_max_key_length):
raise Client.MemcachedKeyLengthError(
"Key length is > %s" % self.server_max_key_length
)
if not valid_key_chars_re.match(key):
raise Client.MemcachedKeyCharacterError(
"Control/space characters not allowed (key=%r)" % key)
class _Host(object):

@@ -1292,3 +1386,3 @@

self.buffer = ''
self.buffer = b''

@@ -1336,3 +1430,3 @@ def debuglog(self, str):

self.socket = s
self.buffer = ''
self.buffer = b''
if self.flush_on_next_connect:

@@ -1349,6 +1443,10 @@ self.flush()

def send_cmd(self, cmd):
self.socket.sendall(cmd + '\r\n')
if isinstance(cmd, six.text_type):
cmd = cmd.encode('utf8')
self.socket.sendall(cmd + b'\r\n')
def send_cmds(self, cmds):
"""cmds already has trailing \r\n's applied."""
if isinstance(cmds, six.text_type):
cmds = cmds.encode('utf8')
self.socket.sendall(cmds)

@@ -1366,6 +1464,6 @@

else:
recv = lambda bufsize: ''
recv = lambda bufsize: b''
while True:
index = buf.find('\r\n')
index = buf.find(b'\r\n')
if index >= 0:

@@ -1388,4 +1486,7 @@ break

line = self.readline(raise_exception)
if line != text:
self.debuglog("while expecting '%s', got unexpected response '%s'"
if self.debug and line != text:
if six.PY3:
text = text.decode('utf8')
line = line.decode('utf8', 'replace')
self.debuglog("while expecting %r, got unexpected response %r"
% (text, line))

@@ -1408,3 +1509,3 @@ return line

self.send_cmd('flush_all')
self.expect('OK')
self.expect(b'OK')

@@ -1450,7 +1551,7 @@ def __str__(self):

def test_setget(key, val):
def test_setget(key, val, noreply=False):
global failures
print("Testing set/get {'%s': %s} ..."
% (to_s(key), to_s(val)), end=" ")
mc.set(key, val)
print("Testing set/get (noreply=%s) {'%s': %s} ..."
% (noreply, to_s(key), to_s(val)), end=" ")
mc.set(key, val, noreply=noreply)
newval = mc.get(key)

@@ -1479,4 +1580,10 @@ if newval == val:

test_setget("a_string", "some random string")
test_setget("a_string_2", "some random string", noreply=True)
test_setget("an_integer", 42)
if test_setget("long", long(1 << 30)):
test_setget("an_integer_2", 42, noreply=True)
if six.PY3:
ok = test_setget("long", 1 << 30)
else:
ok = test_setget("long", long(1 << 30))
if ok:
print("Testing delete ...", end=" ")

@@ -1495,3 +1602,4 @@ if mc.delete("long"):

print("Testing get_multi ...",)
print(mc.get_multi(["a_string", "an_integer"]))
print(mc.get_multi(["a_string", "an_integer", "a_string_2",
"an_integer_2"]))

@@ -1518,2 +1626,3 @@ # removed from the protocol

test_setget("foostruct", f)
test_setget("foostruct_2", f, noreply=True)

@@ -1528,2 +1637,11 @@ print("Testing incr ...", end=" ")

print("Testing incr (noreply=True) ...", end=" ")
mc.incr("an_integer_2", 1, noreply=True)
x = mc.get("an_integer_2")
if x == 43:
print("OK")
else:
print("FAIL")
failures += 1
print("Testing decr ...", end=" ")

@@ -1538,2 +1656,12 @@ x = mc.decr("an_integer", 1)

print("Testing decr (noreply=True) ...", end=" ")
mc.decr("an_integer_2", 1, noreply=True)
x = mc.get("an_integer_2")
if x == 42:
print("OK")
else:
print("FAIL")
failures += 1
sys.stdout.flush()
# sanity tests

@@ -1562,2 +1690,3 @@ print("Testing sending spaces...", end=" ")

x = mc.set('a'*SERVER_MAX_KEY_LENGTH, 1)
x = mc.set('a'*SERVER_MAX_KEY_LENGTH, 1, noreply=True)
except Client.MemcachedKeyLengthError as msg:

@@ -1564,0 +1693,0 @@ print("FAIL")

@@ -1,10 +0,58 @@

Metadata-Version: 1.0
Metadata-Version: 1.1
Name: python-memcached
Version: 1.54
Summary: A Python memcached client library.
Version: 1.56
Summary: Pure python memcached client
Home-page: http://www.tummy.com/Community/software/python-memcached/
Author: Sean Reifschneider
Author-email: jafo-memcached@tummy.com
License: Python Software Foundation License
Description: A Python memcached client library.
Author-email: jafo@tummy.com
License: UNKNOWN
Download-URL: ftp://ftp.tummy.com/pub/python-memcached/
Description: [![Build
Status](https://travis-ci.org/linsomniac/python-memcached.svg)](https://travis-ci.org/linsomniac/python-memcached)
## Overview
This software is a 100% Python interface to the memcached memory cache
daemon. It is the client side software which allows storing values
in one or more, possibly remote, memcached servers. Search google for
memcached for more information.
This package was originally written by Evan Martin of Danga. Please do
not contact Evan about maintenance. Sean Reifschneider of tummy.com,
ltd. has taken over maintenance of it.
Please report issues and submit code changes to the github repository at:
https://github.com/linsomniac/python-memcached
For changes prior to 2013-03-26, see the old Launchpad repository at:
Historic issues: https://launchpad.net/python-memcached
## Testing
Test patches locally and easily by running tox:
pip install tox
tox -e py27
Test for style by running tox:
tox -e pep8
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4

@@ -8,1 +8,7 @@ [bdist_rpm]

universal = 1
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0

@@ -7,3 +7,3 @@ #!/usr/bin/env python

setup(name="python-memcached",
version="1.54",
version="1.56",
description="Pure python memcached client",

@@ -31,6 +31,6 @@ long_description=open("README.md").read(),

"Programming Language :: Python :: 2.7",
# "Programming Language :: Python :: 3",
# "Programming Language :: Python :: 3.2",
# "Programming Language :: Python :: 3.3",
# "Programming Language :: Python :: 3.4"
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4"
])
*.pyc
/dist
/python_memcached.egg-info
.tox
.coverage
language: python
python:
- 2.6
- 2.7
- 3.2
- 3.3
- 3.4
- pypy
- 3.3
install: python setup.py install
before_script: pip install nose
script: nosetests
test:
python memcache.py
( cd tests; make )
clean:
rm -f memcache.pyc memcache.py.orig
push:
bzr push lp:python-memcached
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module memcache</title>
<meta charset="utf-8">
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>memcache</strong></big></big> (version 1.54)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/tmp/python-memcached-1.54/memcache.py">/tmp/python-memcached-1.54/memcache.py</a></font></td></tr></table>
<p><tt>client&nbsp;module&nbsp;for&nbsp;memcached&nbsp;(memory&nbsp;cache&nbsp;daemon)<br>
&nbsp;<br>
Overview<br>
========<br>
&nbsp;<br>
See&nbsp;U{the&nbsp;MemCached&nbsp;homepage&lt;<a href="http://www.danga.com/memcached">http://www.danga.com/memcached</a>&gt;}&nbsp;for&nbsp;more<br>
about&nbsp;memcached.<br>
&nbsp;<br>
Usage&nbsp;summary<br>
=============<br>
&nbsp;<br>
This&nbsp;should&nbsp;give&nbsp;you&nbsp;a&nbsp;feel&nbsp;for&nbsp;how&nbsp;this&nbsp;module&nbsp;operates::<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;import&nbsp;memcache<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc&nbsp;=&nbsp;memcache.<a href="#Client">Client</a>(['127.0.0.1:11211'],&nbsp;debug=0)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.set("some_key",&nbsp;"Some&nbsp;value")<br>
&nbsp;&nbsp;&nbsp;&nbsp;value&nbsp;=&nbsp;mc.get("some_key")<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.set("another_key",&nbsp;3)<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.delete("another_key")<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.set("key",&nbsp;"1")&nbsp;#&nbsp;note&nbsp;that&nbsp;the&nbsp;key&nbsp;used&nbsp;for&nbsp;incr/decr&nbsp;must&nbsp;be<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;a&nbsp;string.<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.incr("key")<br>
&nbsp;&nbsp;&nbsp;&nbsp;mc.decr("key")<br>
&nbsp;<br>
The&nbsp;standard&nbsp;way&nbsp;to&nbsp;use&nbsp;memcache&nbsp;with&nbsp;a&nbsp;database&nbsp;is&nbsp;like&nbsp;this:<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;key&nbsp;=&nbsp;derive_key(obj)<br>
&nbsp;&nbsp;&nbsp;&nbsp;obj&nbsp;=&nbsp;mc.get(key)<br>
&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;not&nbsp;obj:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;obj&nbsp;=&nbsp;backend_api.get(...)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mc.set(key,&nbsp;obj)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;we&nbsp;now&nbsp;have&nbsp;obj,&nbsp;and&nbsp;future&nbsp;passes&nbsp;through&nbsp;this&nbsp;code<br>
&nbsp;&nbsp;&nbsp;&nbsp;#&nbsp;will&nbsp;use&nbsp;the&nbsp;object&nbsp;from&nbsp;the&nbsp;cache.<br>
&nbsp;<br>
Detailed&nbsp;Documentation<br>
======================<br>
&nbsp;<br>
More&nbsp;detailed&nbsp;documentation&nbsp;is&nbsp;available&nbsp;in&nbsp;the&nbsp;L{<a href="#Client">Client</a>}&nbsp;class.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="binascii.html">binascii</a><br>
<a href="os.html">os</a><br>
<a href="pickle.html">pickle</a><br>
</td><td width="25%" valign=top><a href="re.html">re</a><br>
<a href="six.html">six</a><br>
<a href="socket.html">socket</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
<a href="threading.html">threading</a><br>
<a href="time.html">time</a><br>
</td><td width="25%" valign=top><a href="zlib.html">zlib</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="thread.html#_local">thread._local</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="memcache.html#Client">Client</a>
</font></dt></dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Client">class <strong>Client</strong></a>(<a href="thread.html#_local">thread._local</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Object&nbsp;representing&nbsp;a&nbsp;pool&nbsp;of&nbsp;memcache&nbsp;servers.<br>
&nbsp;<br>
See&nbsp;L{memcache}&nbsp;for&nbsp;an&nbsp;overview.<br>
&nbsp;<br>
In&nbsp;all&nbsp;cases&nbsp;where&nbsp;a&nbsp;key&nbsp;is&nbsp;used,&nbsp;the&nbsp;key&nbsp;can&nbsp;be&nbsp;either:<br>
&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;A&nbsp;simple&nbsp;hashable&nbsp;type&nbsp;(string,&nbsp;integer,&nbsp;etc.).<br>
&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;A&nbsp;tuple&nbsp;of&nbsp;C{(hashvalue,&nbsp;key)}.&nbsp;&nbsp;This&nbsp;is&nbsp;useful&nbsp;if&nbsp;you&nbsp;want<br>
&nbsp;&nbsp;&nbsp;&nbsp;to&nbsp;avoid&nbsp;making&nbsp;this&nbsp;module&nbsp;calculate&nbsp;a&nbsp;hash&nbsp;value.&nbsp;&nbsp;You&nbsp;may<br>
&nbsp;&nbsp;&nbsp;&nbsp;prefer,&nbsp;for&nbsp;example,&nbsp;to&nbsp;keep&nbsp;all&nbsp;of&nbsp;a&nbsp;given&nbsp;user's&nbsp;objects&nbsp;on<br>
&nbsp;&nbsp;&nbsp;&nbsp;the&nbsp;same&nbsp;memcache&nbsp;server,&nbsp;so&nbsp;you&nbsp;could&nbsp;use&nbsp;the&nbsp;user's&nbsp;unique<br>
&nbsp;&nbsp;&nbsp;&nbsp;id&nbsp;as&nbsp;the&nbsp;hash&nbsp;value.<br>
&nbsp;<br>
&nbsp;<br>
@group&nbsp;Setup:&nbsp;__init__,&nbsp;set_servers,&nbsp;forget_dead_hosts,<br>
disconnect_all,&nbsp;debuglog<br>
@group&nbsp;Insertion:&nbsp;set,&nbsp;add,&nbsp;replace,&nbsp;set_multi<br>
@group&nbsp;Retrieval:&nbsp;get,&nbsp;get_multi<br>
@group&nbsp;Integers:&nbsp;incr,&nbsp;decr<br>
@group&nbsp;Removal:&nbsp;delete,&nbsp;delete_multi<br>
@sort:&nbsp;__init__,&nbsp;set_servers,&nbsp;forget_dead_hosts,&nbsp;disconnect_all,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;debuglog,\&nbsp;set,&nbsp;set_multi,&nbsp;add,&nbsp;replace,&nbsp;get,&nbsp;get_multi,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incr,&nbsp;decr,&nbsp;delete,&nbsp;delete_multi<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="memcache.html#Client">Client</a></dd>
<dd><a href="thread.html#_local">thread._local</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="Client-__init__"><strong>__init__</strong></a>(self, servers, debug<font color="#909090">=0</font>, pickleProtocol<font color="#909090">=0</font>, pickler<font color="#909090">=&lt;class pickle.Pickler&gt;</font>, unpickler<font color="#909090">=&lt;class pickle.Unpickler&gt;</font>, pload<font color="#909090">=None</font>, pid<font color="#909090">=None</font>, server_max_key_length<font color="#909090">=None</font>, server_max_value_length<font color="#909090">=None</font>, dead_retry<font color="#909090">=30</font>, socket_timeout<font color="#909090">=3</font>, cache_cas<font color="#909090">=False</font>, flush_on_reconnect<font color="#909090">=0</font>, check_keys<font color="#909090">=True</font>)</dt><dd><tt>Create&nbsp;a&nbsp;new&nbsp;<a href="#Client">Client</a>&nbsp;object&nbsp;with&nbsp;the&nbsp;given&nbsp;list&nbsp;of&nbsp;servers.<br>
&nbsp;<br>
@param&nbsp;servers:&nbsp;C{servers}&nbsp;is&nbsp;passed&nbsp;to&nbsp;L{set_servers}.<br>
@param&nbsp;debug:&nbsp;whether&nbsp;to&nbsp;display&nbsp;error&nbsp;messages&nbsp;when&nbsp;a&nbsp;server<br>
can't&nbsp;be&nbsp;contacted.<br>
@param&nbsp;pickleProtocol:&nbsp;number&nbsp;to&nbsp;mandate&nbsp;protocol&nbsp;used&nbsp;by<br>
(c)Pickle.<br>
@param&nbsp;pickler:&nbsp;optional&nbsp;override&nbsp;of&nbsp;default&nbsp;Pickler&nbsp;to&nbsp;allow<br>
subclassing.<br>
@param&nbsp;unpickler:&nbsp;optional&nbsp;override&nbsp;of&nbsp;default&nbsp;Unpickler&nbsp;to<br>
allow&nbsp;subclassing.<br>
@param&nbsp;pload:&nbsp;optional&nbsp;persistent_load&nbsp;function&nbsp;to&nbsp;call&nbsp;on<br>
pickle&nbsp;loading.&nbsp;&nbsp;Useful&nbsp;for&nbsp;cPickle&nbsp;since&nbsp;subclassing&nbsp;isn't<br>
allowed.<br>
@param&nbsp;pid:&nbsp;optional&nbsp;persistent_id&nbsp;function&nbsp;to&nbsp;call&nbsp;on&nbsp;pickle<br>
storing.&nbsp;&nbsp;Useful&nbsp;for&nbsp;cPickle&nbsp;since&nbsp;subclassing&nbsp;isn't&nbsp;allowed.<br>
@param&nbsp;dead_retry:&nbsp;number&nbsp;of&nbsp;seconds&nbsp;before&nbsp;retrying&nbsp;a<br>
blacklisted&nbsp;server.&nbsp;Default&nbsp;to&nbsp;30&nbsp;s.<br>
@param&nbsp;socket_timeout:&nbsp;timeout&nbsp;in&nbsp;seconds&nbsp;for&nbsp;all&nbsp;calls&nbsp;to&nbsp;a<br>
server.&nbsp;Defaults&nbsp;to&nbsp;3&nbsp;seconds.<br>
@param&nbsp;cache_cas:&nbsp;(default&nbsp;False)&nbsp;If&nbsp;true,&nbsp;cas&nbsp;operations&nbsp;will<br>
be&nbsp;cached.&nbsp;&nbsp;WARNING:&nbsp;This&nbsp;cache&nbsp;is&nbsp;not&nbsp;expired&nbsp;internally,&nbsp;if<br>
you&nbsp;have&nbsp;a&nbsp;long-running&nbsp;process&nbsp;you&nbsp;will&nbsp;need&nbsp;to&nbsp;expire&nbsp;it<br>
manually&nbsp;via&nbsp;client.<a href="#Client-reset_cas">reset_cas</a>(),&nbsp;or&nbsp;the&nbsp;cache&nbsp;can&nbsp;grow<br>
unlimited.<br>
@param&nbsp;server_max_key_length:&nbsp;(default&nbsp;SERVER_MAX_KEY_LENGTH)<br>
Data&nbsp;that&nbsp;is&nbsp;larger&nbsp;than&nbsp;this&nbsp;will&nbsp;not&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server.<br>
@param&nbsp;server_max_value_length:&nbsp;(default<br>
SERVER_MAX_VALUE_LENGTH)&nbsp;Data&nbsp;that&nbsp;is&nbsp;larger&nbsp;than&nbsp;this&nbsp;will<br>
not&nbsp;be&nbsp;sent&nbsp;to&nbsp;the&nbsp;server.<br>
@param&nbsp;flush_on_reconnect:&nbsp;optional&nbsp;flag&nbsp;which&nbsp;prevents&nbsp;a<br>
scenario&nbsp;that&nbsp;can&nbsp;cause&nbsp;stale&nbsp;data&nbsp;to&nbsp;be&nbsp;read:&nbsp;If&nbsp;there's&nbsp;more<br>
than&nbsp;one&nbsp;memcached&nbsp;server&nbsp;and&nbsp;the&nbsp;connection&nbsp;to&nbsp;one&nbsp;is<br>
interrupted,&nbsp;keys&nbsp;that&nbsp;mapped&nbsp;to&nbsp;that&nbsp;server&nbsp;will&nbsp;get<br>
reassigned&nbsp;to&nbsp;another.&nbsp;If&nbsp;the&nbsp;first&nbsp;server&nbsp;comes&nbsp;back,&nbsp;those<br>
keys&nbsp;will&nbsp;map&nbsp;to&nbsp;it&nbsp;again.&nbsp;If&nbsp;it&nbsp;still&nbsp;has&nbsp;its&nbsp;data,&nbsp;<a href="#Client-get">get</a>()s<br>
can&nbsp;read&nbsp;stale&nbsp;data&nbsp;that&nbsp;was&nbsp;overwritten&nbsp;on&nbsp;another<br>
server.&nbsp;This&nbsp;flag&nbsp;is&nbsp;off&nbsp;by&nbsp;default&nbsp;for&nbsp;backwards<br>
compatibility.<br>
@param&nbsp;check_keys:&nbsp;(default&nbsp;True)&nbsp;If&nbsp;True,&nbsp;the&nbsp;key&nbsp;is&nbsp;checked<br>
to&nbsp;ensure&nbsp;it&nbsp;is&nbsp;the&nbsp;correct&nbsp;length&nbsp;and&nbsp;composed&nbsp;of&nbsp;the&nbsp;right<br>
characters.</tt></dd></dl>
<dl><dt><a name="Client-add"><strong>add</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Add&nbsp;new&nbsp;key&nbsp;with&nbsp;value.<br>
&nbsp;<br>
Like&nbsp;L{set},&nbsp;but&nbsp;only&nbsp;stores&nbsp;in&nbsp;memcache&nbsp;if&nbsp;the&nbsp;key&nbsp;doesn't<br>
already&nbsp;exist.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-append"><strong>append</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Append&nbsp;the&nbsp;value&nbsp;to&nbsp;the&nbsp;end&nbsp;of&nbsp;the&nbsp;existing&nbsp;key's&nbsp;value.<br>
&nbsp;<br>
Only&nbsp;stores&nbsp;in&nbsp;memcache&nbsp;if&nbsp;key&nbsp;already&nbsp;exists.<br>
Also&nbsp;see&nbsp;L{prepend}.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-cas"><strong>cas</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Check&nbsp;and&nbsp;set&nbsp;(CAS)<br>
&nbsp;<br>
Sets&nbsp;a&nbsp;key&nbsp;to&nbsp;a&nbsp;given&nbsp;value&nbsp;in&nbsp;the&nbsp;memcache&nbsp;if&nbsp;it&nbsp;hasn't&nbsp;been<br>
altered&nbsp;since&nbsp;last&nbsp;fetched.&nbsp;(See&nbsp;L{gets}).<br>
&nbsp;<br>
The&nbsp;C{key}&nbsp;can&nbsp;optionally&nbsp;be&nbsp;an&nbsp;tuple,&nbsp;with&nbsp;the&nbsp;first&nbsp;element<br>
being&nbsp;the&nbsp;server&nbsp;hash&nbsp;value&nbsp;and&nbsp;the&nbsp;second&nbsp;being&nbsp;the&nbsp;key.&nbsp;&nbsp;If<br>
you&nbsp;want&nbsp;to&nbsp;avoid&nbsp;making&nbsp;this&nbsp;module&nbsp;calculate&nbsp;a&nbsp;hash&nbsp;value.<br>
You&nbsp;may&nbsp;prefer,&nbsp;for&nbsp;example,&nbsp;to&nbsp;keep&nbsp;all&nbsp;of&nbsp;a&nbsp;given&nbsp;user's<br>
objects&nbsp;on&nbsp;the&nbsp;same&nbsp;memcache&nbsp;server,&nbsp;so&nbsp;you&nbsp;could&nbsp;use&nbsp;the<br>
user's&nbsp;unique&nbsp;id&nbsp;as&nbsp;the&nbsp;hash&nbsp;value.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int<br>
&nbsp;<br>
@param&nbsp;time:&nbsp;Tells&nbsp;memcached&nbsp;the&nbsp;time&nbsp;which&nbsp;this&nbsp;value&nbsp;should<br>
expire,&nbsp;either&nbsp;as&nbsp;a&nbsp;delta&nbsp;number&nbsp;of&nbsp;seconds,&nbsp;or&nbsp;an&nbsp;absolute<br>
unix&nbsp;time-since-the-epoch&nbsp;value.&nbsp;See&nbsp;the&nbsp;memcached&nbsp;protocol<br>
docs&nbsp;section&nbsp;"Storage&nbsp;Commands"&nbsp;for&nbsp;more&nbsp;info&nbsp;on&nbsp;&lt;exptime&gt;.&nbsp;We<br>
default&nbsp;to&nbsp;0&nbsp;==&nbsp;cache&nbsp;forever.<br>
&nbsp;<br>
@param&nbsp;min_compress_len:&nbsp;The&nbsp;threshold&nbsp;length&nbsp;to&nbsp;kick&nbsp;in<br>
auto-compression&nbsp;of&nbsp;the&nbsp;value&nbsp;using&nbsp;the&nbsp;zlib.<a href="#-compress">compress</a>()<br>
routine.&nbsp;If&nbsp;the&nbsp;value&nbsp;being&nbsp;cached&nbsp;is&nbsp;a&nbsp;string,&nbsp;then&nbsp;the<br>
length&nbsp;of&nbsp;the&nbsp;string&nbsp;is&nbsp;measured,&nbsp;else&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;an<br>
object,&nbsp;then&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;pickle&nbsp;result&nbsp;is&nbsp;measured.&nbsp;If<br>
the&nbsp;resulting&nbsp;attempt&nbsp;at&nbsp;compression&nbsp;yeilds&nbsp;a&nbsp;larger&nbsp;string<br>
than&nbsp;the&nbsp;input,&nbsp;then&nbsp;it&nbsp;is&nbsp;discarded.&nbsp;For&nbsp;backwards<br>
compatability,&nbsp;this&nbsp;parameter&nbsp;defaults&nbsp;to&nbsp;0,&nbsp;indicating&nbsp;don't<br>
ever&nbsp;try&nbsp;to&nbsp;compress.</tt></dd></dl>
<dl><dt><a name="Client-check_key"><strong>check_key</strong></a>(self, key, key_extra_len<font color="#909090">=0</font>)</dt><dd><tt>Checks&nbsp;sanity&nbsp;of&nbsp;key.<br>
&nbsp;<br>
Fails&nbsp;if:<br>
&nbsp;<br>
Key&nbsp;length&nbsp;is&nbsp;&gt;&nbsp;SERVER_MAX_KEY_LENGTH&nbsp;(Raises&nbsp;MemcachedKeyLength).<br>
Contains&nbsp;control&nbsp;characters&nbsp;&nbsp;(Raises&nbsp;MemcachedKeyCharacterError).<br>
Is&nbsp;not&nbsp;a&nbsp;string&nbsp;(Raises&nbsp;MemcachedStringEncodingError)<br>
Is&nbsp;an&nbsp;unicode&nbsp;string&nbsp;(Raises&nbsp;MemcachedStringEncodingError)<br>
Is&nbsp;not&nbsp;a&nbsp;string&nbsp;(Raises&nbsp;MemcachedKeyError)<br>
Is&nbsp;None&nbsp;(Raises&nbsp;MemcachedKeyError)</tt></dd></dl>
<dl><dt><a name="Client-debuglog"><strong>debuglog</strong></a>(self, str)</dt></dl>
<dl><dt><a name="Client-decr"><strong>decr</strong></a>(self, key, delta<font color="#909090">=1</font>)</dt><dd><tt>Decrement&nbsp;value&nbsp;for&nbsp;C{key}&nbsp;by&nbsp;C{delta}<br>
&nbsp;<br>
Like&nbsp;L{incr},&nbsp;but&nbsp;decrements.&nbsp;&nbsp;Unlike&nbsp;L{incr},&nbsp;underflow&nbsp;is<br>
checked&nbsp;and&nbsp;new&nbsp;values&nbsp;are&nbsp;capped&nbsp;at&nbsp;0.&nbsp;&nbsp;If&nbsp;server&nbsp;value&nbsp;is&nbsp;1,<br>
a&nbsp;decrement&nbsp;of&nbsp;2&nbsp;returns&nbsp;0,&nbsp;not&nbsp;-1.<br>
&nbsp;<br>
@param&nbsp;delta:&nbsp;Integer&nbsp;amount&nbsp;to&nbsp;decrement&nbsp;by&nbsp;(should&nbsp;be&nbsp;zero<br>
or&nbsp;greater).<br>
&nbsp;<br>
@return:&nbsp;New&nbsp;value&nbsp;after&nbsp;decrementing&nbsp;or&nbsp;None&nbsp;on&nbsp;error.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-delete"><strong>delete</strong></a>(self, key, time<font color="#909090">=0</font>)</dt><dd><tt>Deletes&nbsp;a&nbsp;key&nbsp;from&nbsp;the&nbsp;memcache.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@param&nbsp;time:&nbsp;number&nbsp;of&nbsp;seconds&nbsp;any&nbsp;subsequent&nbsp;set&nbsp;/&nbsp;update&nbsp;commands<br>
should&nbsp;fail.&nbsp;Defaults&nbsp;to&nbsp;None&nbsp;for&nbsp;no&nbsp;delay.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-delete_multi"><strong>delete_multi</strong></a>(self, keys, time<font color="#909090">=0</font>, key_prefix<font color="#909090">=''</font>)</dt><dd><tt>Delete&nbsp;multiple&nbsp;keys&nbsp;in&nbsp;the&nbsp;memcache&nbsp;doing&nbsp;just&nbsp;one&nbsp;query.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;notset_keys&nbsp;=&nbsp;mc.<a href="#Client-set_multi">set_multi</a>({'a1'&nbsp;:&nbsp;'val1',&nbsp;'a2'&nbsp;:&nbsp;'val2'})<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(['a1',&nbsp;'a2'])&nbsp;==&nbsp;{'a1'&nbsp;:&nbsp;'val1','a2'&nbsp;:&nbsp;'val2'}<br>
1<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-delete_multi">delete_multi</a>(['key1',&nbsp;'key2'])<br>
1<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(['key1',&nbsp;'key2'])&nbsp;==&nbsp;{}<br>
1<br>
&nbsp;<br>
This&nbsp;method&nbsp;is&nbsp;recommended&nbsp;over&nbsp;iterated&nbsp;regular&nbsp;L{delete}s&nbsp;as<br>
it&nbsp;reduces&nbsp;total&nbsp;latency,&nbsp;since&nbsp;your&nbsp;app&nbsp;doesn't&nbsp;have&nbsp;to&nbsp;wait<br>
for&nbsp;each&nbsp;round-trip&nbsp;of&nbsp;L{delete}&nbsp;before&nbsp;sending&nbsp;the&nbsp;next&nbsp;one.<br>
&nbsp;<br>
@param&nbsp;keys:&nbsp;An&nbsp;iterable&nbsp;of&nbsp;keys&nbsp;to&nbsp;clear<br>
@param&nbsp;time:&nbsp;number&nbsp;of&nbsp;seconds&nbsp;any&nbsp;subsequent&nbsp;set&nbsp;/&nbsp;update<br>
commands&nbsp;should&nbsp;fail.&nbsp;Defaults&nbsp;to&nbsp;0&nbsp;for&nbsp;no&nbsp;delay.<br>
@param&nbsp;key_prefix:&nbsp;Optional&nbsp;string&nbsp;to&nbsp;prepend&nbsp;to&nbsp;each&nbsp;key&nbsp;when<br>
&nbsp;&nbsp;&nbsp;&nbsp;sending&nbsp;to&nbsp;memcache.&nbsp;&nbsp;See&nbsp;docs&nbsp;for&nbsp;L{get_multi}&nbsp;and<br>
&nbsp;&nbsp;&nbsp;&nbsp;L{set_multi}.<br>
@return:&nbsp;1&nbsp;if&nbsp;no&nbsp;failure&nbsp;in&nbsp;communication&nbsp;with&nbsp;any&nbsp;memcacheds.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-disconnect_all"><strong>disconnect_all</strong></a>(self)</dt></dl>
<dl><dt><a name="Client-flush_all"><strong>flush_all</strong></a>(self)</dt><dd><tt>Expire&nbsp;all&nbsp;data&nbsp;in&nbsp;memcache&nbsp;servers&nbsp;that&nbsp;are&nbsp;reachable.</tt></dd></dl>
<dl><dt><a name="Client-forget_dead_hosts"><strong>forget_dead_hosts</strong></a>(self)</dt><dd><tt>Reset&nbsp;every&nbsp;host&nbsp;in&nbsp;the&nbsp;pool&nbsp;to&nbsp;an&nbsp;"alive"&nbsp;state.</tt></dd></dl>
<dl><dt><a name="Client-get"><strong>get</strong></a>(self, key)</dt><dd><tt>Retrieves&nbsp;a&nbsp;key&nbsp;from&nbsp;the&nbsp;memcache.<br>
&nbsp;<br>
@return:&nbsp;The&nbsp;value&nbsp;or&nbsp;None.</tt></dd></dl>
<dl><dt><a name="Client-get_multi"><strong>get_multi</strong></a>(self, keys, key_prefix<font color="#909090">=''</font>)</dt><dd><tt>Retrieves&nbsp;multiple&nbsp;keys&nbsp;from&nbsp;the&nbsp;memcache&nbsp;doing&nbsp;just&nbsp;one&nbsp;query.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;success&nbsp;=&nbsp;mc.<a href="#Client-set">set</a>("foo",&nbsp;"bar")<br>
&gt;&gt;&gt;&nbsp;success&nbsp;=&nbsp;mc.<a href="#Client-set">set</a>("baz",&nbsp;42)<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(["foo",&nbsp;"baz",&nbsp;"foobar"])&nbsp;==&nbsp;{<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"foo":&nbsp;"bar",&nbsp;"baz":&nbsp;42<br>
...&nbsp;}<br>
1<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-set_multi">set_multi</a>({'k1'&nbsp;:&nbsp;1,&nbsp;'k2'&nbsp;:&nbsp;2},&nbsp;key_prefix='pfx_')&nbsp;==&nbsp;[]<br>
1<br>
&nbsp;<br>
This&nbsp;looks&nbsp;up&nbsp;keys&nbsp;'pfx_k1',&nbsp;'pfx_k2',&nbsp;...&nbsp;.&nbsp;Returned&nbsp;dict<br>
will&nbsp;just&nbsp;have&nbsp;unprefixed&nbsp;keys&nbsp;'k1',&nbsp;'k2'.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(['k1',&nbsp;'k2',&nbsp;'nonexist'],<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key_prefix='pfx_')&nbsp;==&nbsp;{'k1'&nbsp;:&nbsp;1,&nbsp;'k2'&nbsp;:&nbsp;2}<br>
1<br>
&nbsp;<br>
get_mult&nbsp;[&nbsp;and&nbsp;L{set_multi}&nbsp;]&nbsp;can&nbsp;take&nbsp;str()-ables&nbsp;like&nbsp;ints&nbsp;/<br>
longs&nbsp;as&nbsp;keys&nbsp;too.&nbsp;Such&nbsp;as&nbsp;your&nbsp;db&nbsp;pri&nbsp;key&nbsp;fields.&nbsp;&nbsp;They're<br>
rotored&nbsp;through&nbsp;str()&nbsp;before&nbsp;being&nbsp;passed&nbsp;off&nbsp;to&nbsp;memcache,<br>
with&nbsp;or&nbsp;without&nbsp;the&nbsp;use&nbsp;of&nbsp;a&nbsp;key_prefix.&nbsp;&nbsp;In&nbsp;this&nbsp;mode,&nbsp;the<br>
key_prefix&nbsp;could&nbsp;be&nbsp;a&nbsp;table&nbsp;name,&nbsp;and&nbsp;the&nbsp;key&nbsp;itself&nbsp;a&nbsp;db<br>
primary&nbsp;key&nbsp;number.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-set_multi">set_multi</a>({42:&nbsp;'douglass&nbsp;adams',<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46:&nbsp;'and&nbsp;2&nbsp;just&nbsp;ahead&nbsp;of&nbsp;me'},<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key_prefix='numkeys_')&nbsp;==&nbsp;[]<br>
1<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>([46,&nbsp;42],&nbsp;key_prefix='numkeys_')&nbsp;==&nbsp;{<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;42:&nbsp;'douglass&nbsp;adams',<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46:&nbsp;'and&nbsp;2&nbsp;just&nbsp;ahead&nbsp;of&nbsp;me'<br>
...&nbsp;}<br>
1<br>
&nbsp;<br>
This&nbsp;method&nbsp;is&nbsp;recommended&nbsp;over&nbsp;regular&nbsp;L{get}&nbsp;as&nbsp;it&nbsp;lowers<br>
the&nbsp;number&nbsp;of&nbsp;total&nbsp;packets&nbsp;flying&nbsp;around&nbsp;your&nbsp;network,<br>
reducing&nbsp;total&nbsp;latency,&nbsp;since&nbsp;your&nbsp;app&nbsp;doesn't&nbsp;have&nbsp;to&nbsp;wait<br>
for&nbsp;each&nbsp;round-trip&nbsp;of&nbsp;L{get}&nbsp;before&nbsp;sending&nbsp;the&nbsp;next&nbsp;one.<br>
&nbsp;<br>
See&nbsp;also&nbsp;L{set_multi}.<br>
&nbsp;<br>
@param&nbsp;keys:&nbsp;An&nbsp;array&nbsp;of&nbsp;keys.<br>
&nbsp;<br>
@param&nbsp;key_prefix:&nbsp;A&nbsp;string&nbsp;to&nbsp;prefix&nbsp;each&nbsp;key&nbsp;when&nbsp;we<br>
communicate&nbsp;with&nbsp;memcache.&nbsp;&nbsp;Facilitates&nbsp;pseudo-namespaces<br>
within&nbsp;memcache.&nbsp;Returned&nbsp;dictionary&nbsp;keys&nbsp;will&nbsp;not&nbsp;have&nbsp;this<br>
prefix.<br>
&nbsp;<br>
@return:&nbsp;A&nbsp;dictionary&nbsp;of&nbsp;key/value&nbsp;pairs&nbsp;that&nbsp;were<br>
available.&nbsp;If&nbsp;key_prefix&nbsp;was&nbsp;provided,&nbsp;the&nbsp;keys&nbsp;in&nbsp;the&nbsp;retured<br>
dictionary&nbsp;will&nbsp;not&nbsp;have&nbsp;it&nbsp;present.</tt></dd></dl>
<dl><dt><a name="Client-get_slabs"><strong>get_slabs</strong></a>(self)</dt></dl>
<dl><dt><a name="Client-get_stats"><strong>get_stats</strong></a>(self, stat_args<font color="#909090">=None</font>)</dt><dd><tt>Get&nbsp;statistics&nbsp;from&nbsp;each&nbsp;of&nbsp;the&nbsp;servers.<br>
&nbsp;<br>
@param&nbsp;stat_args:&nbsp;Additional&nbsp;arguments&nbsp;to&nbsp;pass&nbsp;to&nbsp;the&nbsp;memcache<br>
&nbsp;&nbsp;&nbsp;&nbsp;"stats"&nbsp;command.<br>
&nbsp;<br>
@return:&nbsp;A&nbsp;list&nbsp;of&nbsp;tuples&nbsp;(&nbsp;server_identifier,<br>
&nbsp;&nbsp;&nbsp;&nbsp;stats_dictionary&nbsp;).&nbsp;&nbsp;The&nbsp;dictionary&nbsp;contains&nbsp;a&nbsp;number&nbsp;of<br>
&nbsp;&nbsp;&nbsp;&nbsp;name/value&nbsp;pairs&nbsp;specifying&nbsp;the&nbsp;name&nbsp;of&nbsp;the&nbsp;status&nbsp;field<br>
&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;the&nbsp;string&nbsp;value&nbsp;associated&nbsp;with&nbsp;it.&nbsp;&nbsp;The&nbsp;values&nbsp;are<br>
&nbsp;&nbsp;&nbsp;&nbsp;not&nbsp;converted&nbsp;from&nbsp;strings.</tt></dd></dl>
<dl><dt><a name="Client-gets"><strong>gets</strong></a>(self, key)</dt><dd><tt>Retrieves&nbsp;a&nbsp;key&nbsp;from&nbsp;the&nbsp;memcache.&nbsp;Used&nbsp;in&nbsp;conjunction&nbsp;with&nbsp;'cas'.<br>
&nbsp;<br>
@return:&nbsp;The&nbsp;value&nbsp;or&nbsp;None.</tt></dd></dl>
<dl><dt><a name="Client-incr"><strong>incr</strong></a>(self, key, delta<font color="#909090">=1</font>)</dt><dd><tt>Increment&nbsp;value&nbsp;for&nbsp;C{key}&nbsp;by&nbsp;C{delta}<br>
&nbsp;<br>
Sends&nbsp;a&nbsp;command&nbsp;to&nbsp;the&nbsp;server&nbsp;to&nbsp;atomically&nbsp;increment&nbsp;the<br>
value&nbsp;for&nbsp;C{key}&nbsp;by&nbsp;C{delta},&nbsp;or&nbsp;by&nbsp;1&nbsp;if&nbsp;C{delta}&nbsp;is<br>
unspecified.&nbsp;&nbsp;Returns&nbsp;None&nbsp;if&nbsp;C{key}&nbsp;doesn't&nbsp;exist&nbsp;on&nbsp;server,<br>
otherwise&nbsp;it&nbsp;returns&nbsp;the&nbsp;new&nbsp;value&nbsp;after&nbsp;incrementing.<br>
&nbsp;<br>
Note&nbsp;that&nbsp;the&nbsp;value&nbsp;for&nbsp;C{key}&nbsp;must&nbsp;already&nbsp;exist&nbsp;in&nbsp;the<br>
memcache,&nbsp;and&nbsp;it&nbsp;must&nbsp;be&nbsp;the&nbsp;string&nbsp;representation&nbsp;of&nbsp;an<br>
integer.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-set">set</a>("counter",&nbsp;"20")&nbsp;&nbsp;#&nbsp;returns&nbsp;1,&nbsp;indicating&nbsp;success<br>
1<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-incr">incr</a>("counter")<br>
21<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-incr">incr</a>("counter")<br>
22<br>
&nbsp;<br>
Overflow&nbsp;on&nbsp;server&nbsp;is&nbsp;not&nbsp;checked.&nbsp;&nbsp;Be&nbsp;aware&nbsp;of&nbsp;values<br>
approaching&nbsp;2**32.&nbsp;&nbsp;See&nbsp;L{decr}.<br>
&nbsp;<br>
@param&nbsp;delta:&nbsp;Integer&nbsp;amount&nbsp;to&nbsp;increment&nbsp;by&nbsp;(should&nbsp;be&nbsp;zero<br>
or&nbsp;greater).<br>
&nbsp;<br>
@return:&nbsp;New&nbsp;value&nbsp;after&nbsp;incrementing.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-prepend"><strong>prepend</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Prepend&nbsp;the&nbsp;value&nbsp;to&nbsp;the&nbsp;beginning&nbsp;of&nbsp;the&nbsp;existing&nbsp;key's&nbsp;value.<br>
&nbsp;<br>
Only&nbsp;stores&nbsp;in&nbsp;memcache&nbsp;if&nbsp;key&nbsp;already&nbsp;exists.<br>
Also&nbsp;see&nbsp;L{append}.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-replace"><strong>replace</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Replace&nbsp;existing&nbsp;key&nbsp;with&nbsp;value.<br>
&nbsp;<br>
Like&nbsp;L{set},&nbsp;but&nbsp;only&nbsp;stores&nbsp;in&nbsp;memcache&nbsp;if&nbsp;the&nbsp;key&nbsp;already&nbsp;exists.<br>
The&nbsp;opposite&nbsp;of&nbsp;L{add}.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int</tt></dd></dl>
<dl><dt><a name="Client-reset_cas"><strong>reset_cas</strong></a>(self)</dt><dd><tt>Reset&nbsp;the&nbsp;cas&nbsp;cache.<br>
&nbsp;<br>
This&nbsp;is&nbsp;only&nbsp;used&nbsp;if&nbsp;the&nbsp;<a href="#Client">Client</a>()&nbsp;object&nbsp;was&nbsp;created&nbsp;with<br>
"cache_cas=True".&nbsp;&nbsp;If&nbsp;used,&nbsp;this&nbsp;cache&nbsp;does&nbsp;not&nbsp;expire<br>
internally,&nbsp;so&nbsp;it&nbsp;can&nbsp;grow&nbsp;unbounded&nbsp;if&nbsp;you&nbsp;do&nbsp;not&nbsp;clear&nbsp;it<br>
yourself.</tt></dd></dl>
<dl><dt><a name="Client-set"><strong>set</strong></a>(self, key, val, time<font color="#909090">=0</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Unconditionally&nbsp;sets&nbsp;a&nbsp;key&nbsp;to&nbsp;a&nbsp;given&nbsp;value&nbsp;in&nbsp;the&nbsp;memcache.<br>
&nbsp;<br>
The&nbsp;C{key}&nbsp;can&nbsp;optionally&nbsp;be&nbsp;an&nbsp;tuple,&nbsp;with&nbsp;the&nbsp;first&nbsp;element<br>
being&nbsp;the&nbsp;server&nbsp;hash&nbsp;value&nbsp;and&nbsp;the&nbsp;second&nbsp;being&nbsp;the&nbsp;key.&nbsp;&nbsp;If<br>
you&nbsp;want&nbsp;to&nbsp;avoid&nbsp;making&nbsp;this&nbsp;module&nbsp;calculate&nbsp;a&nbsp;hash&nbsp;value.<br>
You&nbsp;may&nbsp;prefer,&nbsp;for&nbsp;example,&nbsp;to&nbsp;keep&nbsp;all&nbsp;of&nbsp;a&nbsp;given&nbsp;user's<br>
objects&nbsp;on&nbsp;the&nbsp;same&nbsp;memcache&nbsp;server,&nbsp;so&nbsp;you&nbsp;could&nbsp;use&nbsp;the<br>
user's&nbsp;unique&nbsp;id&nbsp;as&nbsp;the&nbsp;hash&nbsp;value.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@rtype:&nbsp;int<br>
&nbsp;<br>
@param&nbsp;time:&nbsp;Tells&nbsp;memcached&nbsp;the&nbsp;time&nbsp;which&nbsp;this&nbsp;value&nbsp;should<br>
expire,&nbsp;either&nbsp;as&nbsp;a&nbsp;delta&nbsp;number&nbsp;of&nbsp;seconds,&nbsp;or&nbsp;an&nbsp;absolute<br>
unix&nbsp;time-since-the-epoch&nbsp;value.&nbsp;See&nbsp;the&nbsp;memcached&nbsp;protocol<br>
docs&nbsp;section&nbsp;"Storage&nbsp;Commands"&nbsp;for&nbsp;more&nbsp;info&nbsp;on&nbsp;&lt;exptime&gt;.&nbsp;We<br>
default&nbsp;to&nbsp;0&nbsp;==&nbsp;cache&nbsp;forever.<br>
&nbsp;<br>
@param&nbsp;min_compress_len:&nbsp;The&nbsp;threshold&nbsp;length&nbsp;to&nbsp;kick&nbsp;in<br>
auto-compression&nbsp;of&nbsp;the&nbsp;value&nbsp;using&nbsp;the&nbsp;zlib.<a href="#-compress">compress</a>()<br>
routine.&nbsp;If&nbsp;the&nbsp;value&nbsp;being&nbsp;cached&nbsp;is&nbsp;a&nbsp;string,&nbsp;then&nbsp;the<br>
length&nbsp;of&nbsp;the&nbsp;string&nbsp;is&nbsp;measured,&nbsp;else&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;an<br>
object,&nbsp;then&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;pickle&nbsp;result&nbsp;is&nbsp;measured.&nbsp;If<br>
the&nbsp;resulting&nbsp;attempt&nbsp;at&nbsp;compression&nbsp;yeilds&nbsp;a&nbsp;larger&nbsp;string<br>
than&nbsp;the&nbsp;input,&nbsp;then&nbsp;it&nbsp;is&nbsp;discarded.&nbsp;For&nbsp;backwards<br>
compatability,&nbsp;this&nbsp;parameter&nbsp;defaults&nbsp;to&nbsp;0,&nbsp;indicating&nbsp;don't<br>
ever&nbsp;try&nbsp;to&nbsp;compress.</tt></dd></dl>
<dl><dt><a name="Client-set_multi"><strong>set_multi</strong></a>(self, mapping, time<font color="#909090">=0</font>, key_prefix<font color="#909090">=''</font>, min_compress_len<font color="#909090">=0</font>)</dt><dd><tt>Sets&nbsp;multiple&nbsp;keys&nbsp;in&nbsp;the&nbsp;memcache&nbsp;doing&nbsp;just&nbsp;one&nbsp;query.<br>
&nbsp;<br>
&gt;&gt;&gt;&nbsp;notset_keys&nbsp;=&nbsp;mc.<a href="#Client-set_multi">set_multi</a>({'key1'&nbsp;:&nbsp;'val1',&nbsp;'key2'&nbsp;:&nbsp;'val2'})<br>
&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(['key1',&nbsp;'key2'])&nbsp;==&nbsp;{'key1'&nbsp;:&nbsp;'val1',<br>
...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'key2'&nbsp;:&nbsp;'val2'}<br>
1<br>
&nbsp;<br>
&nbsp;<br>
This&nbsp;method&nbsp;is&nbsp;recommended&nbsp;over&nbsp;regular&nbsp;L{set}&nbsp;as&nbsp;it&nbsp;lowers<br>
the&nbsp;number&nbsp;of&nbsp;total&nbsp;packets&nbsp;flying&nbsp;around&nbsp;your&nbsp;network,<br>
reducing&nbsp;total&nbsp;latency,&nbsp;since&nbsp;your&nbsp;app&nbsp;doesn't&nbsp;have&nbsp;to&nbsp;wait<br>
for&nbsp;each&nbsp;round-trip&nbsp;of&nbsp;L{set}&nbsp;before&nbsp;sending&nbsp;the&nbsp;next&nbsp;one.<br>
&nbsp;<br>
@param&nbsp;mapping:&nbsp;A&nbsp;dict&nbsp;of&nbsp;key/value&nbsp;pairs&nbsp;to&nbsp;set.<br>
&nbsp;<br>
@param&nbsp;time:&nbsp;Tells&nbsp;memcached&nbsp;the&nbsp;time&nbsp;which&nbsp;this&nbsp;value&nbsp;should<br>
&nbsp;&nbsp;&nbsp;&nbsp;expire,&nbsp;either&nbsp;as&nbsp;a&nbsp;delta&nbsp;number&nbsp;of&nbsp;seconds,&nbsp;or&nbsp;an<br>
&nbsp;&nbsp;&nbsp;&nbsp;absolute&nbsp;unix&nbsp;time-since-the-epoch&nbsp;value.&nbsp;See&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;memcached&nbsp;protocol&nbsp;docs&nbsp;section&nbsp;"Storage&nbsp;Commands"&nbsp;for<br>
&nbsp;&nbsp;&nbsp;&nbsp;more&nbsp;info&nbsp;on&nbsp;&lt;exptime&gt;.&nbsp;We&nbsp;default&nbsp;to&nbsp;0&nbsp;==&nbsp;cache&nbsp;forever.<br>
&nbsp;<br>
@param&nbsp;key_prefix:&nbsp;Optional&nbsp;string&nbsp;to&nbsp;prepend&nbsp;to&nbsp;each&nbsp;key&nbsp;when<br>
&nbsp;&nbsp;&nbsp;&nbsp;sending&nbsp;to&nbsp;memcache.&nbsp;Allows&nbsp;you&nbsp;to&nbsp;efficiently&nbsp;stuff&nbsp;these<br>
&nbsp;&nbsp;&nbsp;&nbsp;keys&nbsp;into&nbsp;a&nbsp;pseudo-namespace&nbsp;in&nbsp;memcache:<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;notset_keys&nbsp;=&nbsp;mc.<a href="#Client-set_multi">set_multi</a>(<br>
&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{'key1'&nbsp;:&nbsp;'val1',&nbsp;'key2'&nbsp;:&nbsp;'val2'},<br>
&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key_prefix='subspace_')<br>
&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;len(notset_keys)&nbsp;==&nbsp;0<br>
&nbsp;&nbsp;&nbsp;&nbsp;True<br>
&nbsp;&nbsp;&nbsp;&nbsp;&gt;&gt;&gt;&nbsp;mc.<a href="#Client-get_multi">get_multi</a>(['subspace_key1',<br>
&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'subspace_key2'])&nbsp;==&nbsp;{'subspace_key1':&nbsp;'val1',<br>
&nbsp;&nbsp;&nbsp;&nbsp;...&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'subspace_key2'&nbsp;:&nbsp;'val2'}<br>
&nbsp;&nbsp;&nbsp;&nbsp;True<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;Causes&nbsp;key&nbsp;'subspace_key1'&nbsp;and&nbsp;'subspace_key2'&nbsp;to&nbsp;be<br>
&nbsp;&nbsp;&nbsp;&nbsp;set.&nbsp;Useful&nbsp;in&nbsp;conjunction&nbsp;with&nbsp;a&nbsp;higher-level&nbsp;layer&nbsp;which<br>
&nbsp;&nbsp;&nbsp;&nbsp;applies&nbsp;namespaces&nbsp;to&nbsp;data&nbsp;in&nbsp;memcache.&nbsp;&nbsp;In&nbsp;this&nbsp;case,&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;result&nbsp;would&nbsp;be&nbsp;the&nbsp;list&nbsp;of&nbsp;notset&nbsp;original&nbsp;keys,<br>
&nbsp;&nbsp;&nbsp;&nbsp;prefix&nbsp;not&nbsp;applied.<br>
&nbsp;<br>
@param&nbsp;min_compress_len:&nbsp;The&nbsp;threshold&nbsp;length&nbsp;to&nbsp;kick&nbsp;in<br>
&nbsp;&nbsp;&nbsp;&nbsp;auto-compression&nbsp;of&nbsp;the&nbsp;value&nbsp;using&nbsp;the&nbsp;zlib.<a href="#-compress">compress</a>()<br>
&nbsp;&nbsp;&nbsp;&nbsp;routine.&nbsp;If&nbsp;the&nbsp;value&nbsp;being&nbsp;cached&nbsp;is&nbsp;a&nbsp;string,&nbsp;then&nbsp;the<br>
&nbsp;&nbsp;&nbsp;&nbsp;length&nbsp;of&nbsp;the&nbsp;string&nbsp;is&nbsp;measured,&nbsp;else&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;an<br>
&nbsp;&nbsp;&nbsp;&nbsp;object,&nbsp;then&nbsp;the&nbsp;length&nbsp;of&nbsp;the&nbsp;pickle&nbsp;result&nbsp;is<br>
&nbsp;&nbsp;&nbsp;&nbsp;measured.&nbsp;If&nbsp;the&nbsp;resulting&nbsp;attempt&nbsp;at&nbsp;compression&nbsp;yeilds&nbsp;a<br>
&nbsp;&nbsp;&nbsp;&nbsp;larger&nbsp;string&nbsp;than&nbsp;the&nbsp;input,&nbsp;then&nbsp;it&nbsp;is&nbsp;discarded.&nbsp;For<br>
&nbsp;&nbsp;&nbsp;&nbsp;backwards&nbsp;compatability,&nbsp;this&nbsp;parameter&nbsp;defaults&nbsp;to&nbsp;0,<br>
&nbsp;&nbsp;&nbsp;&nbsp;indicating&nbsp;don't&nbsp;ever&nbsp;try&nbsp;to&nbsp;compress.<br>
&nbsp;<br>
@return:&nbsp;List&nbsp;of&nbsp;keys&nbsp;which&nbsp;failed&nbsp;to&nbsp;be&nbsp;stored&nbsp;[&nbsp;memcache&nbsp;out<br>
&nbsp;&nbsp;&nbsp;of&nbsp;memory,&nbsp;etc.&nbsp;].<br>
&nbsp;<br>
@rtype:&nbsp;list</tt></dd></dl>
<dl><dt><a name="Client-set_servers"><strong>set_servers</strong></a>(self, servers)</dt><dd><tt>Set&nbsp;the&nbsp;pool&nbsp;of&nbsp;servers&nbsp;used&nbsp;by&nbsp;this&nbsp;client.<br>
&nbsp;<br>
@param&nbsp;servers:&nbsp;an&nbsp;array&nbsp;of&nbsp;servers.<br>
Servers&nbsp;can&nbsp;be&nbsp;passed&nbsp;in&nbsp;two&nbsp;forms:<br>
&nbsp;&nbsp;&nbsp;&nbsp;1.&nbsp;Strings&nbsp;of&nbsp;the&nbsp;form&nbsp;C{"host:port"},&nbsp;which&nbsp;implies&nbsp;a<br>
&nbsp;&nbsp;&nbsp;&nbsp;default&nbsp;weight&nbsp;of&nbsp;1.<br>
&nbsp;&nbsp;&nbsp;&nbsp;2.&nbsp;Tuples&nbsp;of&nbsp;the&nbsp;form&nbsp;C{("host:port",&nbsp;weight)},&nbsp;where<br>
&nbsp;&nbsp;&nbsp;&nbsp;C{weight}&nbsp;is&nbsp;an&nbsp;integer&nbsp;weight&nbsp;value.</tt></dd></dl>
<dl><dt><a name="Client-touch"><strong>touch</strong></a>(self, key, time<font color="#909090">=0</font>)</dt><dd><tt>Updates&nbsp;the&nbsp;expiration&nbsp;time&nbsp;of&nbsp;a&nbsp;key&nbsp;in&nbsp;memcache.<br>
&nbsp;<br>
@return:&nbsp;Nonzero&nbsp;on&nbsp;success.<br>
@param&nbsp;time:&nbsp;Tells&nbsp;memcached&nbsp;the&nbsp;time&nbsp;which&nbsp;this&nbsp;value&nbsp;should<br>
&nbsp;&nbsp;&nbsp;&nbsp;expire,&nbsp;either&nbsp;as&nbsp;a&nbsp;delta&nbsp;number&nbsp;of&nbsp;seconds,&nbsp;or&nbsp;an&nbsp;absolute<br>
&nbsp;&nbsp;&nbsp;&nbsp;unix&nbsp;time-since-the-epoch&nbsp;value.&nbsp;See&nbsp;the&nbsp;memcached&nbsp;protocol<br>
&nbsp;&nbsp;&nbsp;&nbsp;docs&nbsp;section&nbsp;"Storage&nbsp;Commands"&nbsp;for&nbsp;more&nbsp;info&nbsp;on&nbsp;&lt;exptime&gt;.&nbsp;We<br>
&nbsp;&nbsp;&nbsp;&nbsp;default&nbsp;to&nbsp;0&nbsp;==&nbsp;cache&nbsp;forever.<br>
@rtype:&nbsp;int</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>MemcachedKeyCharacterError</strong> = &lt;class 'memcache.MemcachedKeyCharacterError'&gt;</dl>
<dl><dt><strong>MemcachedKeyError</strong> = &lt;class 'memcache.MemcachedKeyError'&gt;</dl>
<dl><dt><strong>MemcachedKeyLengthError</strong> = &lt;class 'memcache.MemcachedKeyLengthError'&gt;</dl>
<dl><dt><strong>MemcachedKeyNoneError</strong> = &lt;class 'memcache.MemcachedKeyNoneError'&gt;</dl>
<dl><dt><strong>MemcachedKeyTypeError</strong> = &lt;class 'memcache.MemcachedKeyTypeError'&gt;</dl>
<dl><dt><strong>MemcachedStringEncodingError</strong> = &lt;class 'memcache.MemcachedStringEncodingError'&gt;</dl>
<hr>
Methods inherited from <a href="thread.html#_local">thread._local</a>:<br>
<dl><dt><a name="Client-__delattr__"><strong>__delattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Client-__delattr__">__delattr__</a>('name')&nbsp;&lt;==&gt;&nbsp;del&nbsp;x.name</tt></dd></dl>
<dl><dt><a name="Client-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Client-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>
<dl><dt><a name="Client-__setattr__"><strong>__setattr__</strong></a>(...)</dt><dd><tt>x.<a href="#Client-__setattr__">__setattr__</a>('name',&nbsp;value)&nbsp;&lt;==&gt;&nbsp;x.name&nbsp;=&nbsp;value</tt></dd></dl>
<hr>
Data and other attributes inherited from <a href="thread.html#_local">thread._local</a>:<br>
<dl><dt><strong>__new__</strong> = &lt;built-in method __new__ of type object&gt;<dd><tt>T.<a href="#Client-__new__">__new__</a>(S,&nbsp;...)&nbsp;-&gt;&nbsp;a&nbsp;new&nbsp;object&nbsp;with&nbsp;type&nbsp;S,&nbsp;a&nbsp;subtype&nbsp;of&nbsp;T</tt></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-cmemcache_hash"><strong>cmemcache_hash</strong></a>(key)</dt></dl>
<dl><dt><a name="-compress"><strong>compress</strong></a>(...)</dt><dd><tt><a href="#-compress">compress</a>(string[,&nbsp;level])&nbsp;--&nbsp;Returned&nbsp;compressed&nbsp;string.<br>
&nbsp;<br>
Optional&nbsp;arg&nbsp;level&nbsp;is&nbsp;the&nbsp;compression&nbsp;level,&nbsp;in&nbsp;0-9.</tt></dd></dl>
<dl><dt><a name="-decompress"><strong>decompress</strong></a>(...)</dt><dd><tt><a href="#-decompress">decompress</a>(string[,&nbsp;wbits[,&nbsp;bufsize]])&nbsp;--&nbsp;Return&nbsp;decompressed&nbsp;string.<br>
&nbsp;<br>
Optional&nbsp;arg&nbsp;wbits&nbsp;is&nbsp;the&nbsp;window&nbsp;buffer&nbsp;size.&nbsp;&nbsp;Optional&nbsp;arg&nbsp;bufsize&nbsp;is<br>
the&nbsp;initial&nbsp;output&nbsp;buffer&nbsp;size.</tt></dd></dl>
<dl><dt><a name="-serverHashFunction"><strong>serverHashFunction</strong></a> = cmemcache_hash(key)</dt></dl>
<dl><dt><a name="-useOldServerHashFunction"><strong>useOldServerHashFunction</strong></a>()</dt><dd><tt>Use&nbsp;the&nbsp;old&nbsp;python-memcache&nbsp;server&nbsp;hash&nbsp;function.</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>SERVER_MAX_KEY_LENGTH</strong> = 250<br>
<strong>SERVER_MAX_VALUE_LENGTH</strong> = 1048576<br>
<strong>__author__</strong> = 'Sean Reifschneider &lt;jafo-memcached@tummy.com&gt;'<br>
<strong>__copyright__</strong> = 'Copyright (C) 2003 Danga Interactive'<br>
<strong>__license__</strong> = 'Python Software Foundation License'<br>
<strong>__version__</strong> = '1.54'<br>
<strong>print_function</strong> = _Feature((2, 6, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 65536)<br>
<strong>valid_key_chars_re</strong> = &lt;_sre.SRE_Pattern object&gt;</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#7799ee">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Author</strong></big></font></td></tr>
<tr><td bgcolor="#7799ee"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Sean&nbsp;Reifschneider&nbsp;&lt;jafo-memcached@tummy.com&gt;</td></tr></table>
</body></html>
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python
alone or in any derivative version, provided, however, that PSF's
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative
version prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python.
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. Nothing in this License Agreement shall be deemed to create any
relationship of agency, partnership, or joint venture between PSF and
Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
-------------------------------------------
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
Individual or Organization ("Licensee") accessing and otherwise using
this software in source or binary form and its associated
documentation ("the Software").
2. Subject to the terms and conditions of this BeOpen Python License
Agreement, BeOpen hereby grants Licensee a non-exclusive,
royalty-free, world-wide license to reproduce, analyze, test, perform
and/or display publicly, prepare derivative works, distribute, and
otherwise use the Software alone or in any derivative version,
provided, however, that the BeOpen Python License is retained in the
Software, alone or in any derivative version prepared by Licensee.
3. BeOpen is making the Software available to Licensee on an "AS IS"
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
5. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
6. This License Agreement shall be governed by and interpreted in all
respects by the law of the State of California, excluding conflict of
law provisions. Nothing in this License Agreement shall be deemed to
create any relationship of agency, partnership, or joint venture
between BeOpen and Licensee. This License Agreement does not grant
permission to use BeOpen trademarks or trade names in a trademark
sense to endorse or promote products or services of Licensee, or any
third party. As an exception, the "BeOpen Python" logos available at
http://www.pythonlabs.com/logos.html may be used according to the
permissions granted on that web page.
7. By copying, installing or otherwise using the software, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
---------------------------------------
1. This LICENSE AGREEMENT is between the Corporation for National
Research Initiatives, having an office at 1895 Preston White Drive,
Reston, VA 20191 ("CNRI"), and the Individual or Organization
("Licensee") accessing and otherwise using Python 1.6.1 software in
source or binary form and its associated documentation.
2. Subject to the terms and conditions of this License Agreement, CNRI
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python 1.6.1
alone or in any derivative version, provided, however, that CNRI's
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
1995-2001 Corporation for National Research Initiatives; All Rights
Reserved" are retained in Python 1.6.1 alone or in any derivative
version prepared by Licensee. Alternately, in lieu of CNRI's License
Agreement, Licensee may substitute the following text (omitting the
quotes): "Python 1.6.1 is made available subject to the terms and
conditions in CNRI's License Agreement. This Agreement together with
Python 1.6.1 may be located on the Internet using the following
unique, persistent identifier (known as a handle): 1895.22/1013. This
Agreement may also be obtained from a proxy server on the Internet
using the following URL: http://hdl.handle.net/1895.22/1013".
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python 1.6.1 or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python 1.6.1.
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
breach of its terms and conditions.
7. This License Agreement shall be governed by the federal
intellectual property law of the United States, including without
limitation the federal copyright law, and, to the extent such
U.S. federal law does not apply, by the law of the Commonwealth of
Virginia, excluding Virginia's conflict of law provisions.
Notwithstanding the foregoing, with regard to derivative works based
on Python 1.6.1 that incorporate non-separable material that was
previously distributed under the GNU General Public License (GPL), the
law of the Commonwealth of Virginia shall govern this License
Agreement only as to issues arising under or with respect to
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
License Agreement shall be deemed to create any relationship of
agency, partnership, or joint venture between CNRI and Licensee. This
License Agreement does not grant permission to use CNRI trademarks or
trade name in a trademark sense to endorse or promote products or
services of Licensee, or any third party.
8. By clicking on the "ACCEPT" button where indicated, or by copying,
installing or otherwise using Python 1.6.1, Licensee agrees to be
bound by the terms and conditions of this License Agreement.
ACCEPT
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
--------------------------------------------------
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
The Netherlands. All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Stichting Mathematisch
Centrum or CWI not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
This copy of Python includes a copy of bzip2, which is licensed under the following terms:
This program, "bzip2", the associated library "libbzip2", and all
documentation, are copyright (C) 1996-2005 Julian R Seward. All
rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. The origin of this software must not be misrepresented; you must
not claim that you wrote the original software. If you use this
software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
3. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
4. The name of the author may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Julian Seward, Cambridge, UK.
jseward@acm.org
bzip2/libbzip2 version 1.0.3 of 15 February 2005
This copy of Python includes a copy of db, which is licensed under the following terms:
/*-
* $Id: LICENSE,v 12.1 2005/06/16 20:20:10 bostic Exp $
*/
The following is the license that applies to this copy of the Berkeley DB
software. For a license to use the Berkeley DB software under conditions
other than those described here, or to purchase support for this software,
please contact Sleepycat Software by email at info@sleepycat.com, or on
the Web at http://www.sleepycat.com.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
/*
* Copyright (c) 1990-2005
* Sleepycat Software. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Redistributions in any form must be accompanied by information on
* how to obtain complete source code for the DB software and any
* accompanying software that uses the DB software. The source code
* must either be included in the distribution or be available for no
* more than the cost of distribution plus a nominal fee, and must be
* freely redistributable under reasonable conditions. For an
* executable file, complete source code means the source code for all
* modules it contains. It does not include source code for modules or
* files that typically accompany the major components of the operating
* system on which the executable file runs.
*
* THIS SOFTWARE IS PROVIDED BY SLEEPYCAT SOFTWARE ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
* NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL SLEEPYCAT SOFTWARE
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* Copyright (c) 1990, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* Copyright (c) 1995, 1996
* The President and Fellows of Harvard University. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY HARVARD AND ITS CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL HARVARD OR ITS CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
This copy of Python includes a copy of openssl, which is licensed under the following terms:
LICENSE ISSUES
==============
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
the OpenSSL License and the original SSLeay license apply to the toolkit.
See below for the actual license texts. Actually both licenses are BSD-style
Open Source licenses. In case of any license issues related to OpenSSL
please contact openssl-core@openssl.org.
OpenSSL License
---------------
/* ====================================================================
* Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
Original SSLeay License
-----------------------
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
This copy of Python includes a copy of tcl, which is licensed under the following terms:
This software is copyrighted by the Regents of the University of
California, Sun Microsystems, Inc., Scriptics Corporation, ActiveState
Corporation and other parties. The following terms apply to all files
associated with the software unless explicitly disclaimed in
individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
This copy of Python includes a copy of tk, which is licensed under the following terms:
This software is copyrighted by the Regents of the University of
California, Sun Microsystems, Inc., and other parties. The following
terms apply to all files associated with the software unless explicitly
disclaimed in individual files.
The authors hereby grant permission to use, copy, modify, distribute,
and license this software and its documentation for any purpose, provided
that existing copyright notices are retained in all copies and that this
notice is included verbatim in any distributions. No written agreement,
license, or royalty fee is required for any of the authorized uses.
Modifications to this software may be copyrighted by their authors
and need not follow the licensing terms described here, provided that
the new terms are clearly indicated on the first page of each file where
they apply.
IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.
#!/usr/bin/env python
#
# Tests for set_multi.
#
# ==============
# This is based on a skeleton test file, more information at:
#
# https://github.com/linsomniac/python-unittest-skeleton
from __future__ import print_function
import socket
import sys
import unittest
sys.path.append('..')
import memcache
DEBUG = False
class test_Memcached_Set_Multi(unittest.TestCase):
def setUp(self):
RECV_CHUNKS = ['chunk1']
class FakeSocket(object):
def __init__(self, *args):
if DEBUG:
print('FakeSocket{0!r}'.format(args))
self._recv_chunks = list(RECV_CHUNKS)
def connect(self, *args):
if DEBUG:
print('FakeSocket.connect{0!r}'.format(args))
def sendall(self, *args):
if DEBUG:
print('FakeSocket.sendall{0!r}'.format(args))
def recv(self, *args):
if self._recv_chunks:
data = self._recv_chunks.pop(0)
else:
data = ''
if DEBUG:
print('FakeSocket.recv{0!r} -> {1!r}'.format(args, data))
return data
def close(self):
if DEBUG:
print('FakeSocket.close()')
self.old_socket = socket.socket
socket.socket = FakeSocket
def tearDown(self):
socket.socket = self.old_socket
def test_Socket_Disconnect(self):
client = memcache.Client(['memcached'], debug=True)
mapping = {'foo': 'FOO', 'bar': 'BAR'}
bad_keys = client.set_multi(mapping)
self.assertEqual(sorted(bad_keys), ['bar', 'foo'])
if DEBUG:
print('set_multi({0!r}) -> {1!r}'.format(mapping, bad_keys))
if __name__ == '__main__':
unittest.main()
[tox]
minversion = 1.6
envlist = py26,py27,py32,py33,py34,pypy,pep8
skipsdist = True
[testenv]
usedevelop = True
# Customize pip command, add -U to force updates.
install_command = pip install -U {opts} {packages}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = nosetests {posargs}
[tox:jenkins]
downloadcache = ~/cache/pip
[testenv:pep8]
commands = flake8
[testenv:cover]
commands = nosetests --with-coverage {posargs}
[flake8]
exclude = .venv*,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*.egg,.update-venv

Sorry, the diff of this file is not supported yet