<commit_before>"""
    groceries export
    module to produce Groceries.app importable output
"""

import json
import sys
from urllib import quote


class FoodList:
    """ Exporting a YAML groceries list as an import
        for Groceries.app
    """
    def __init__(self, aisles_json_file):
        try:
            aisles_json = json.loads(open(aisles_json_file).read())
        except IOError:
            sys.exit(-1)
        self.data = None
        # the aisles as imported from the json dump
        self.aisles_raw = aisles_json["aisles"]
        # the aisles for matching the list items against
        self.aisles_master = {}
        # the list data which in different format
        self.list_data = []
        for aisle in self.aisles_raw:
            self.aisles_master[aisle["name"]] = {"id" : aisle["id"],
                                                 "image" : aisle["imageName"]}

    def set_groceries(self, groceries):
        """ set groceries list """
        self.groceries = groceries

    def export_list(self, groceries, name = "Imported Groceries"):
        """ export groceries to correct format and
            returns it as string
        """
        if not self.data:
            self.build_groceries_data(groceries, name)
        return quote(json.dumps(self.data))

    def build_groceries_data(self, groceries, name = "Imported Groceries"):
        """ build the complete groceries data set """
        data = {}
        grocs = self.convert_groceries(groceries)
        data["items"] = grocs
        data["name"] = name
        data["aisles"] = self.aisles_raw<commit_msg>remove unneeded method<commit_after>"""
    groceries export
    module to produce Groceries.app importable output
"""

import json
import sys
from urllib import quote


class FoodList:
    """ Exporting a YAML groceries list as an import
        for Groceries.app
    """
    def __init__(self, aisles_json_file):
        try:
            aisles_json = json.loads(open(aisles_json_file).read())
        except IOError:
            sys.exit(-1)
        self.data = None
        # the aisles as imported from the json dump
        self.aisles_raw = aisles_json["aisles"]
        # the aisles for matching the list items against
        self.aisles_master = {}
        # the list data which in different format
        self.list_data = []
        for aisle in self.aisles_raw:
            self.aisles_master[aisle["name"]] = {"id" : aisle["id"],
                                                 "image" : aisle["imageName"]}

    def export_list(self, groceries, name = "Imported Groceries"):
        """ export groceries to correct format and
            returns it as string
        """
        if not self.data:
            self.build_groceries_data(groceries, name)
        return quote(json.dumps(self.data))

    def build_groceries_data(self, groceries, name = "Imported Groceries"):
        """ build the complete groceries data set """
        data = {}
        grocs = self.convert_groceries(groceries)
        data["items"] = grocs
        data["name"] = name
        data["aisles"] = self.aisles_raw
{'fraction_non_alphanumeric': 0.09743589743589744, 'fraction_numerical': 0.000641025641025641, 'mean_word_length': 2.165314401622718, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4584834', 'n_tokens_mistral': 923, 'n_tokens_neox': 895, 'n_words': 249}