<commit_before>from ..utils import DictObject
from ..exceptions import BGGError
from .things import Thing

class GeekListComment(DictObject):
    """
    Object containing details about a comment in a geeklist
    """
    def __init__(self, data):
        super(GeekListComment, self).__init__(data)

    def __repr__(self):
        return "GeekListComment (on {} by [{}])".format(self.date, self.username)

    def _format(self, log):
        log.info("date           : {}".format(self.date))
        log.info("  username     : {}".format(self.username))
        log.info("  postdate     : {}".format(self.postdate))
        log.info("  editdate     : {}".format(self.editdate))
        log.info("  thumbs count : {}".format(self.thumbs))
        log.info("  text         : {}".format(self.text))


class GeekList(Thing):
    """
    Object containing information about a geeklist
    """
    def __init__(self, data):
        self._comments = []
        self._items = []
        super(GeekList, self).__init__(data)

    def __repr__(self):
        return "GeekList (id: {})".format(self.id)

    def add_comment(self, comment_data):
        """
        Add a comment to the ``GeekList``

        :param dict comment_data: comment data
        :raises: :py:class:`boardgamegeek.exceptions.BoardGameGeekError` in case of invalid data
        """
        try:
            comment = GeekListComment(comment_data)
        except KeyError:
            raise BGGError("invalid item data")
        self._comments.append(comment)
        return comment

    def add_item(self, item_data):
        """
        Add an item to the ``GeekList``

        :param dict item_data: item data
        :raises: :py:class:`boardgamegeek.exceptions.BoardGameGeekError` in case of invalid data<commit_msg>fix(geeklist): add missing __len__ method<commit_after>from ..utils import DictObject
from ..exceptions import BGGError
from .things import Thing

class GeekListComment(DictObject):
    """
    Object containing details about a comment in a geeklist
    """
    def __init__(self, data):
        super(GeekListComment, self).__init__(data)

    def __repr__(self):
        return "GeekListComment (on {} by [{}])".format(self.date, self.username)

    def _format(self, log):
        log.info("date           : {}".format(self.date))
        log.info("  username     : {}".format(self.username))
        log.info("  postdate     : {}".format(self.postdate))
        log.info("  editdate     : {}".format(self.editdate))
        log.info("  thumbs count : {}".format(self.thumbs))
        log.info("  text         : {}".format(self.text))


class GeekList(Thing):
    """
    Object containing information about a geeklist
    """
    def __init__(self, data):
        self._comments = []
        self._items = []
        super(GeekList, self).__init__(data)

    def __repr__(self):
        return "GeekList (id: {})".format(self.id)

    def __len__(self):
        return len(self._items)

    def add_comment(self, comment_data):
        """
        Add a comment to the ``GeekList``

        :param dict comment_data: comment data
        :raises: :py:class:`boardgamegeek.exceptions.BoardGameGeekError` in case of invalid data
        """
        try:
            comment = GeekListComment(comment_data)
        except KeyError:
            raise BGGError("invalid item data")
        self._comments.append(comment)
        return comment

    def add_item(self, item_data):
        """
        Add an item to the ``GeekList``

        :param dict item_data: item data
        :raises: :py:class:`boardgamegeek.exceptions.BoardGameGeekError` in case of invalid data
{'fraction_non_alphanumeric': 0.12452107279693486, 'fraction_numerical': 0.0, 'mean_word_length': 2.5110470701248797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3497074', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1080, 'n_words': 271}