Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tahmed-dev committed Jul 24, 2020
1 parent 2d2b7e1 commit 994851c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/swsssdk/configdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def raw_to_typed(self, raw_data):
for raw_key in raw_data:
key = raw_key
if PY3K:
key = raw_key.decode('utf-8')
key = raw_key.decode()

# "NULL:NULL" is used as a placeholder for objects with no attributes
if key == "NULL":
Expand All @@ -136,7 +136,7 @@ def raw_to_typed(self, raw_data):
typed_data[key[:-1]] = value
else:
if PY3K:
typed_data[key] = raw_data[raw_key].decode('utf-8')
typed_data[key] = raw_data[raw_key].decode()
else:
typed_data[key] = raw_data[raw_key]
return typed_data
Expand Down Expand Up @@ -240,7 +240,7 @@ def get_keys(self, table, split=True):
for key in keys:
try:
if PY3K:
key = key.decode('utf-8')
key = key.decode()
if split:
(_, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
data.append(self.deserialize_key(row))
Expand Down Expand Up @@ -269,7 +269,7 @@ def get_table(self, table):
entry = self.raw_to_typed(client.hgetall(key))
if entry != None:
if PY3K:
key = key.decode('utf-8')
key = key.decode()
(_, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
data[self.deserialize_key(row)] = entry
else:
Expand Down Expand Up @@ -325,7 +325,7 @@ def get_config(self):
data = {}
for key in keys:
if PY3K:
key = key.decode('utf-8')
key = key.decode()
try:
(table_name, row) = key.split(self.TABLE_NAME_SEPARATOR, 1)
entry = self.raw_to_typed(client.hgetall(key))
Expand Down Expand Up @@ -427,7 +427,7 @@ def _get_config(self, client, pipe, data, cursor):
cur: poition of next item to scan
"""
cur, keys = client.scan(cursor=cursor, match='*', count=self.REDIS_SCAN_BATCH_SIZE)
keys = [key.decode('utf-8') for key in keys if key != self.INIT_INDICATOR]
keys = [key.decode() for key in keys if key != self.INIT_INDICATOR]
for key in keys:
pipe.hgetall(key)
records = pipe.execute()
Expand Down

0 comments on commit 994851c

Please sign in to comment.