summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Charriere <nicholas@pinterest.com>2016-10-04 10:19:26 -0700
committerNicholas Charriere <nicholas@pinterest.com>2016-10-04 10:19:26 -0700
commit0acff70a0ea88f249a89b8dbb51de27d8b2953dc (patch)
treee025b19f1ef4cc16516ef53a907b553be3a30023
parent9aaa8398dbda9c5042d41c270eb5eb9523480171 (diff)
downloadpymemcache-0acff70a0ea88f249a89b8dbb51de27d8b2953dc.tar.gz
Make tuple once, instead of on every call
-rw-r--r--pymemcache/client/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pymemcache/client/base.py b/pymemcache/client/base.py
index 515e456..d62dd80 100644
--- a/pymemcache/client/base.py
+++ b/pymemcache/client/base.py
@@ -36,6 +36,7 @@ VALID_STORE_RESULTS = {
b'prepend': (b'STORED', b'NOT_STORED'),
b'cas': (b'STORED', b'EXISTS', b'NOT_FOUND'),
}
+VALID_STRING_TYPES = (six.text_type, six.string_types)
# Some of the values returned by the "stats" command
@@ -82,8 +83,7 @@ STAT_TYPES = {
def _check_key(key, key_prefix=b''):
"""Checks key and add key_prefix."""
- allowed_str_types = (six.text_type, six.string_types)
- if isinstance(key, allowed_str_types):
+ if isinstance(key, VALID_STRING_TYPES):
try:
key = key.encode('ascii')
except (UnicodeEncodeError, UnicodeDecodeError):