The paging function is designed to take a list of responses and split it into smaller, manageable pages based on a specified maximum size for each page.
What the function should do: The function should return a generator that yields smaller lists (pages) of the original list. Each yielded list should contain at most max_results elements. This allows for efficient processing of large datasets by handling a limited number of items at a time.
Expected input/output behavior:
Input: The function takes in two arguments:
response (list): A list of items (WAPI responses).
max_results (int): An integer representing the maximum number of items to include in each page.
Output: The output should be a generator that, when iterated over, yields lists of items, with each list containing up to max_results items from the input response.
Edge cases to handle:
An empty response list should return a generator that yields nothing.
If max_results is less than or equal to zero, the behavior should be clearly defined (the generator should yield nothing).
If max_results is greater than the length of the response, the entire list should be returned in a single yield.
Note: The solution should be placed in /app/solution.py.
The function must be importable as: from solution import paging.