fix linting error

This commit is contained in:
Stephan Huber 2018-06-28 13:10:09 +02:00
parent 10f96b2ccf
commit a73dc49258

View File

@ -281,14 +281,15 @@ class IoTBackend(BaseBackend):
def list_things(self, attribute_name, attribute_value, thing_type_name, max_results, token):
all_things = [_.to_dict() for _ in self.things.values()]
if attribute_name is not None and thing_type_name is not None:
filtered_things = list(
filter(
lambda elem: attribute_name in elem["attributes"] and elem["attributes"][
attribute_name] == attribute_value and "thingTypeName" in elem and elem[
"thingTypeName"] == thing_type_name, all_things))
filtered_things = list(filter(lambda elem:
attribute_name in elem["attributes"] and
elem["attributes"][attribute_name] == attribute_value and
"thingTypeName" in elem and
elem["thingTypeName"] == thing_type_name, all_things))
elif attribute_name is not None and thing_type_name is None:
filtered_things = list(filter(lambda elem: attribute_name in elem["attributes"] and elem["attributes"][
attribute_name] == attribute_value, all_things))
filtered_things = list(filter(lambda elem:
attribute_name in elem["attributes"] and
elem["attributes"][attribute_name] == attribute_value, all_things))
elif attribute_name is None and thing_type_name is not None:
filtered_things = list(
filter(lambda elem: "thingTypeName" in elem and elem["thingTypeName"] == thing_type_name, all_things))