Commit b41f5182 authored by Matias Guijarro's avatar Matias Guijarro
Browse files

HashObjSetting: do not duplicate items() method, fix string comparison with "is"

parent 5196fa02
Pipeline #47864 passed with stages
in 110 minutes and 38 seconds
......@@ -646,7 +646,6 @@ class BaseHashSetting(BaseSetting):
def items(self):
cnx = self.connection
next_id = 0
seen_keys = set()
while True:
next_id, pd = cnx.hscan(self.name, next_id)
for k, v in pd.items():
......@@ -654,9 +653,8 @@ class BaseHashSetting(BaseSetting):
k = k.decode()
if self._read_type_conversion:
v = self._read_type_conversion(v)
seen_keys.add(k)
yield k, v
if not next_id or next_id is "0":
if not next_id or next_id == "0":
break
def __getitem__(self, key):
......@@ -959,20 +957,10 @@ class HashSetting(BaseHashSetting):
return all_dict
def items(self):
cnx = self.connection
next_id = 0
seen_keys = set()
while True:
next_id, pd = cnx.hscan(self.name, next_id)
for k, v in pd.items():
# Add key conversion
k = k.decode()
if self._read_type_conversion:
v = self._read_type_conversion(v)
for k, v in super().items():
seen_keys.add(k)
yield k, v
if not next_id or next_id is "0":
break
for k, v in self._default_values.items():
if k in seen_keys:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment