mirror of
https://github.com/OpenMTC/OpenMTC.git
synced 2025-01-14 08:49:56 +00:00
replaces reduce with for loop in nodb driver
This commit is contained in:
parent
a8987f441b
commit
61b2dad009
@ -65,18 +65,18 @@ class NoDB2Session(BasicSession):
|
||||
|
||||
if parent.__model_name__ == "onem2m":
|
||||
if resource_type is None:
|
||||
resources = self.children[parent.path].values()
|
||||
resources = map(dict.values, resources)
|
||||
resources = reduce(list.__add__, resources, [])
|
||||
resources = []
|
||||
for v in self.children[parent.path].values():
|
||||
resources += list(v.values())
|
||||
elif isinstance(resource_type, (list, tuple, set)):
|
||||
resources = [v for k, v in self.children[parent.path].items()
|
||||
if k in resource_type]
|
||||
resources = map(dict.values, resources)
|
||||
resources = reduce(list.__add__, resources, [])
|
||||
resources = []
|
||||
for k, v in self.children[parent.path].items():
|
||||
if k in resource_type:
|
||||
resources + list(v.values())
|
||||
else:
|
||||
resources = self.children[parent.path][resource_type].values()
|
||||
resources = list(self.children[parent.path][resource_type].values())
|
||||
else:
|
||||
resources = self.children[parent.path][resource_type].values()
|
||||
resources = list(self.children[parent.path][resource_type].values())
|
||||
self.logger.debug("Found children: %s", resources)
|
||||
return resources
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user