def __init__(self, cls, initial_list=None): UserList.__init__(self) if initial_list: for item in initial_list: if isinstance(item, cls): self.data.append(item) elif isinstance(item, dict): self.data.append(cls.from_json(item))
def __init__(self, values, offset=None, total=None, limit=None): UserList.__init__(self, values) # if set, this is the index in the overall results of the first element of # this list self.offset = offset # if set, this is the total number of results self.total = total # if set, this is the limit, either from the user or the implementation self.limit = limit