48
48
from __future__ import print_function
49
49
50
50
import binascii
51
- import os
52
51
import re
53
52
import socket
54
53
import sys
55
54
import threading
56
55
import time
57
56
import zlib
57
+ from io import BytesIO
58
58
59
59
import six
60
60
@@ -75,7 +75,6 @@ def useOldServerHashFunction():
75
75
global serverHashFunction
76
76
serverHashFunction = binascii .crc32
77
77
78
- from io import BytesIO
79
78
80
79
valid_key_chars_re = re .compile (b'[\x21 -\x7e \x80 -\xff ]+$' )
81
80
@@ -353,7 +352,7 @@ def get_slab_stats(self):
353
352
break
354
353
item = line .split (' ' , 2 )
355
354
if line .startswith ('STAT active_slabs' ) or line .startswith ('STAT total_malloced' ):
356
- serverData [item [1 ]]= item [2 ]
355
+ serverData [item [1 ]] = item [2 ]
357
356
else :
358
357
# 0 = STAT, 1 = ITEM, 2 = Value
359
358
slab = item [1 ].split (':' , 2 )
@@ -764,7 +763,8 @@ def cas(self, key, val, time=0, min_compress_len=0, noreply=False):
764
763
return self ._set ("cas" , key , val , time , min_compress_len , noreply )
765
764
766
765
def _map_and_prefix_keys (self , key_iterable , key_prefix ):
767
- """Compute the mapping of server (_Host instance) -> list of keys to
766
+ """
767
+ Compute the mapping of server (_Host instance) -> list of keys to
768
768
stuff onto that server, as well as the mapping of prefixed key
769
769
-> original key.
770
770
"""
@@ -966,7 +966,7 @@ def _val_to_store_info(self, val, min_compress_len):
966
966
val = val .encode ('ascii' )
967
967
# force no attempt to compress this silly string.
968
968
min_compress_len = 0
969
- elif six .PY2 and isinstance (val , long ):
969
+ elif six .PY2 and isinstance (val , long ): # noqa: F821
970
970
flags |= Client ._FLAG_LONG
971
971
val = str (val )
972
972
if six .PY3 :
@@ -1263,7 +1263,7 @@ def _recv_value(self, server, flags, rlen):
1263
1263
if six .PY3 :
1264
1264
val = int (buf )
1265
1265
else :
1266
- val = long (buf )
1266
+ val = long (buf ) # noqa: F821
1267
1267
elif flags & Client ._FLAG_PICKLE :
1268
1268
try :
1269
1269
file = BytesIO (buf )
0 commit comments