from hoerapi.errors import MissingAttributeError, InvalidDataError


def parser_list(clazz, data):
    items = []

    if isinstance(data, list):
        for item in data:
            items.append(parser_object(clazz, item))
    else:
        raise InvalidDataError('not an array')

    return items


def parser_object(clazz, data):
    try:
        return clazz(data)
    except KeyError as e:
        raise MissingAttributeError(e)
@@ -96,24 +96,8 @@
 a):%0A
-    items = %5B%5D%0A%0A
     
@@ -135,51 +135,16 @@
     
-for item in data:%0A            items.append(
+return %5B
 pars
@@ -165,17 +165,34 @@
 z, item)
-)
+ for item in data%5D
 %0A    els
@@ -246,26 +246,8 @@
 ')%0A%0A
-    return items%0A%0A
 %0Adef

use list comprehension in parser_list