Skip to content

Commit

Permalink
making lgtm happy
Browse files Browse the repository at this point in the history
  • Loading branch information
tahmed-dev committed Jul 23, 2020
1 parent fa9093c commit 2d2b7e1
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 @@ -114,7 +114,7 @@ def listen(self):
pass #Ignore non table-formated redis entries

def raw_to_typed(self, raw_data):
if raw_data == None:
if raw_data is None:
return None
typed_data = {}
for raw_key in raw_data:
Expand Down Expand Up @@ -142,7 +142,7 @@ def raw_to_typed(self, raw_data):
return typed_data

def typed_to_raw(self, typed_data):
if typed_data == None:
if typed_data is None:
return None
elif typed_data == {}:
return { "NULL": "NULL" }
Expand Down Expand Up @@ -183,7 +183,7 @@ def set_entry(self, table, key, data):
key = self.serialize_key(key)
client = self.get_redis_client(self.db_name)
_hash = '{}{}{}'.format(table.upper(), self.TABLE_NAME_SEPARATOR, key)
if data == None:
if data is None:
client.delete(_hash)
else:
original = self.get_entry(table, key)
Expand All @@ -205,7 +205,7 @@ def mod_entry(self, table, key, data):
key = self.serialize_key(key)
client = self.get_redis_client(self.db_name)
_hash = '{}{}{}'.format(table.upper(), self.TABLE_NAME_SEPARATOR, key)
if data == None:
if data is None:
client.delete(_hash)
else:
client.hmset(_hash, self.typed_to_raw(data))
Expand Down Expand Up @@ -387,7 +387,7 @@ def __mod_entry(self, pipe, table, key, data):
"""
key = self.serialize_key(key)
_hash = '{}{}{}'.format(table.upper(), self.TABLE_NAME_SEPARATOR, key)
if data == None:
if data is None:
pipe.delete(_hash)
else:
pipe.hmset(_hash, self.typed_to_raw(data))
Expand All @@ -407,7 +407,7 @@ def mod_config(self, data):
pipe = client.pipeline()
for table_name in data:
table_data = data[table_name]
if table_data == None:
if table_data is None:
self.__delete_table(client, pipe, table_name)
continue
for key in table_data:
Expand Down

0 comments on commit 2d2b7e1

Please sign in to comment.