<commit_before>import os
import json
import re
import codecs
from utils import stdout_logger as logger


class BeerList:
    def __init__(self):
        self.__items = []
        self.__attrs = ('abv', 'alcohol', 'name', '^volume$', '^price$', 'sellstart',
                        'score', 'url', 'href', '^type$')

    def add(self, b):
        if not b or len(b.keys()) < 0:
            return

        self.__items.append({
            k: v for k, v in b.iteritems()
            if any([a for a in self.__attrs if any(re.findall(a, k.lower()))])
        })

    def save(self):
        filename = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/beers.json'
        with codecs.open(filename, 'w', 'utf-8') as file:
            logger.info('write', 'to ' + filename)
            file.truncate()
            file.write(unicode(json.dumps(self.__items, indent=2, ensure_ascii=False)))<commit_msg>update data keys<commit_after>import os
import json
import re
import codecs
from utils import stdout_logger as logger


class BeerList:
    def __init__(self):
        self.__items = []
        self.__include_keys = ('abv', 'alcohol', 'name', '^volume$', '^price$',  'score',
                               'url', 'href', '^type$')

    def add(self, b):
        if not b or len(b.keys()) < 0:
            return

        self.__items.append({
            k: v for k, v in b.iteritems()
            if any([a for a in self.__include_keys if any(re.findall(a, k.lower()))])
        })

    def save(self):
        filename = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/beers.json'
        with codecs.open(filename, 'w', 'utf-8') as file:
            logger.info('write', 'to ' + filename)
            file.truncate()
            file.write(unicode(json.dumps(self.__items, indent=2, ensure_ascii=False)))
{'fraction_non_alphanumeric': 0.15413943355119825, 'fraction_numerical': 0.0032679738562091504, 'mean_word_length': 2.2686832740213525, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5352127', 'n_tokens_mistral': 601, 'n_tokens_neox': 582, 'n_words': 150}