<commit_before>import numpy as np

STAT_ATTRS = ['likes',
              'checkin_count',
              'people_talking',
              'rating',
              'rating_count',
              'user_count',
              'tip_count']


class Stats(object):
    def __init__(self, data):
        self.data = data

    @property
    def stats(self):
        stats = {}
        for attr in dir(self):
            if attr in STAT_ATTRS:
                stats[attr] = getattr(self, attr)


class FacebookStats(Stats):
    @property
    def likes(self):
        likes = [i.get('likes') for i in self.data]
        return {'average': round(np.average(likes), 1),
                'total': np.sum(likes)}

    @property
    def checkin_count(self):
        checkin_count = [i.get('checkin_count') for i in self.data]
        return {'average': round(np.average(checkin_count), 1),
                'total': np.sum(checkin_count)}

    @property
    def people_talking(self):
        people_talking = [i.get('people_talking') for i in self.data]<commit_msg>return stats<commit_after>import numpy as np

STAT_ATTRS = ['likes',
              'checkin_count',
              'people_talking',
              'rating',
              'rating_count',
              'user_count',
              'tip_count']


class Stats(object):
    def __init__(self, data):
        self.data = data

    @property
    def stats(self):
        stats = {}
        for attr in dir(self):
            if attr in STAT_ATTRS:
                stats[attr] = getattr(self, attr)
        return stats


class FacebookStats(Stats):
    @property
    def likes(self):
        likes = [i.get('likes') for i in self.data]
        return {'average': round(np.average(likes), 1),
                'total': np.sum(likes)}

    @property
    def checkin_count(self):
        checkin_count = [i.get('checkin_count') for i in self.data]
        return {'average': round(np.average(checkin_count), 1),
                'total': np.sum(checkin_count)}

    @property
    def people_talking(self):
        people_talking = [i.get('people_talking') for i in self.data]
{'fraction_non_alphanumeric': 0.12357414448669202, 'fraction_numerical': 0.0019011406844106464, 'mean_word_length': 1.9985754985754987, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '790312', 'n_tokens_mistral': 663, 'n_tokens_neox': 634, 'n_words': 152}