diff --git a/moto/iot/models.py b/moto/iot/models.py index 0ef53bbb5..c36bb985f 100644 --- a/moto/iot/models.py +++ b/moto/iot/models.py @@ -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))