# Path: aiohttp_json_api/helpers.py
# def ensure_collection(value, exclude=()):
#     """Ensure value is collection."""
#     return value if is_collection(value, exclude=exclude) else (value,)


import abc
import random
        import mimesis
        import mimesis
        import mimesis
from typing import Sequence, Generator
from aiohttp_json_api.helpers import ensure_collection
class Comment(BaseModel):
    def __init__(self, id: int, body: str, author: 'People'):
        super().__init__(id)
        self.body = body
        self.author = author

    def __repr__(self):
        return self._repr(('id', 'body', 'author'))

    @staticmethod
    def populate(authors: Sequence['People'],
                 count=100) -> Generator['Comment', None, None]:

        cid = mimesis.Numbers()
        comment = mimesis.Text()

        return (
            Comment(id=cid.between(1, count),
                    body=comment.sentence(),
                    author=random.choice(authors))
            for _ in range(count)
        )


class Article(BaseModel):
    def __init__(self, id: int, title: str, author: 'People',
                 comments: Sequence['Comment']):
        super().__init__(id)
        self.title = title
        self.author = author

# Path: aiohttp_json_api/helpers.py
# def ensure_collection(value, exclude=()):
#     """Ensure value is collection."""
#     return value if is_collection(value, exclude=exclude) else (value,)


# Path: examples/simple/models.py
import abc
import random
        import mimesis
        import mimesis
        import mimesis
from typing import Sequence, Generator
from aiohttp_json_api.helpers import ensure_collection

class Comment(BaseModel):
    def __init__(self, id: int, body: str, author: 'People'):
        super().__init__(id)
        self.body = body
        self.author = author

    def __repr__(self):
        return self._repr(('id', 'body', 'author'))

    @staticmethod
    def populate(authors: Sequence['People'],
                 count=100) -> Generator['Comment', None, None]:

        cid = mimesis.Numbers()
        comment = mimesis.Text()

        return (
            Comment(id=cid.between(1, count),
                    body=comment.sentence(),
                    author=random.choice(authors))
            for _ in range(count)
        )


class Article(BaseModel):
    def __init__(self, id: int, title: str, author: 'People',
                 comments: Sequence['Comment']):
        super().__init__(id)
        self.title = title
        self.author = author

        self.comments = list(ensure_collection(comments))