Skip to content

Commit 994851c

Browse files
committed
review comments
1 parent 2d2b7e1 commit 994851c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/swsssdk/configdb.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def raw_to_typed(self, raw_data):
120120
for raw_key in raw_data:
121121
key = raw_key
122122
if PY3K:
123-
key = raw_key.decode('utf-8')
123+
key = raw_key.decode()
124124

125125
# "NULL:NULL" is used as a placeholder for objects with no attributes
126126
if key == "NULL":
@@ -136,7 +136,7 @@ def raw_to_typed(self, raw_data):
136136
typed_data[key[:-1]] = value
137137
else:
138138
if PY3K:
139-
typed_data[key] = raw_data[raw_key].decode('utf-8')
139+
typed_data[key] = raw_data[raw_key].decode()
140140
else:
141141
typed_data[key] = raw_data[raw_key]
142142
return typed_data
@@ -240,7 +240,7 @@ def get_keys(self, table, split=True):
240240
for key in keys:
241241
try:
242242
if PY3K:
243-
key = key.decode('utf-8')
243+
key = key.decode()
244244
if split:
245245
(_, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
246246
data.append(self.deserialize_key(row))
@@ -269,7 +269,7 @@ def get_table(self, table):
269269
entry = self.raw_to_typed(client.hgetall(key))
270270
if entry != None:
271271
if PY3K:
272-
key = key.decode('utf-8')
272+
key = key.decode()
273273
(_, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
274274
data[self.deserialize_key(row)] = entry
275275
else:
@@ -325,7 +325,7 @@ def get_config(self):
325325
data = {}
326326
for key in keys:
327327
if PY3K:
328-
key = key.decode('utf-8')
328+
key = key.decode()
329329
try:
330330
(table_name, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
331331
entry = self.raw_to_typed(client.hgetall(key))
@@ -427,7 +427,7 @@ def _get_config(self, client, pipe, data, cursor):
427427
cur: poition of next item to scan
428428
"""
429429
cur, keys = client.scan(cursor=cursor, match='*', count=self.REDIS_SCAN_BATCH_SIZE)
430-
keys = [key.decode('utf-8') for key in keys if key != self.INIT_INDICATOR]
430+
keys = [key.decode() for key in keys if key != self.INIT_INDICATOR]
431431
for key in keys:
432432
pipe.hgetall(key)
433433
records = pipe.execute()

0 commit comments

Comments
 (0)