From 994851c8e95f143dfebc59c2e89878876bee225d Mon Sep 17 00:00:00 2001 From: Tamer Ahmed Date: Fri, 24 Jul 2020 14:44:15 -0700 Subject: [PATCH] review comments --- src/swsssdk/configdb.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/swsssdk/configdb.py b/src/swsssdk/configdb.py index 0996f023b27c..ab0ee86dc97f 100644 --- a/src/swsssdk/configdb.py +++ b/src/swsssdk/configdb.py @@ -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": @@ -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 @@ -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)) @@ -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: @@ -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)) @@ -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()