<commit_before>import tkinter
from tkinter import ttk
from tkinter import filedialog
import pathlib
import configparser
import itertools

import widgets
import file


counter = itertools.count().__next__


BASE = pathlib.Path()

SETTINGS = configparser.ConfigParser()
if (BASE/".config").exists():
    SETTINGS.read(".config")
else:
    SETTINGS["default"] = {
        "current_directory": str(BASE.home()),
        "opened_files": [],
    }


def wheel_name(text):
    name = pathlib.Path(text)
    return str(pathlib.Path()/name.parent.parts[-1]/name.name)


class App(tkinter.Frame):
    def __init__(self, root):
        super().__init__(root)
        self.root = root
        self.grid(row=0, column=0)
        self.current_directory = SETTINGS["default"]["current_directory"]

        # create the toolbar
        self.toolbar = tkinter.Frame(self.root)
        self.toolbar.grid(row=0, column=0, sticky=tkinter.W)

        self.new_button = tkinter.Button(
            self.toolbar, text="nuevo", command=self.new_wheel,
            highlightthickness=0)
        self.new_button.grid(row=0, column=0)

        self.open_button = tkinter.Button(
            self.toolbar, text="abrir", highlightthickness=0,
            command=self.open_wheel)
        self.open_button.grid(row=0, column=1)
<commit_msg>fix error when .config not exists<commit_after>import tkinter
from tkinter import ttk
from tkinter import filedialog
import pathlib
import configparser
import itertools

import widgets
import file


counter = itertools.count().__next__


BASE = pathlib.Path()

SETTINGS = configparser.ConfigParser()
if (BASE/".config").exists():
    SETTINGS.read(".config")
else:
    SETTINGS["default"] = {
        "current_directory": str(BASE.home()),
        "opened_files": [],
    }


def wheel_name(text):
    name = pathlib.Path(text)
    parts = name.parent.parts
    if parts:
        return str(pathlib.Path()/name.parts[-1]/name.name)
    else:

        return "untitled-%s" % counter()


class App(tkinter.Frame):
    def __init__(self, root):
        super().__init__(root)
        self.root = root
        self.grid(row=0, column=0)
        self.current_directory = SETTINGS["default"]["current_directory"]

        # create the toolbar
        self.toolbar = tkinter.Frame(self.root)
        self.toolbar.grid(row=0, column=0, sticky=tkinter.W)

        self.new_button = tkinter.Button(
            self.toolbar, text="nuevo", command=self.new_wheel,
            highlightthickness=0)
        self.new_button.grid(row=0, column=0)

        self.open_button = tkinter.Button(
            self.toolbar, text="abrir", highlightthickness=0,
            command=self.open_wheel)
        self.open_button.grid(row=0, column=1)

{'fraction_non_alphanumeric': 0.12660080497621662, 'fraction_numerical': 0.00804976216611782, 'mean_word_length': 2.997076023391813, 'pattern_counts': {'":': 4, '<': 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': '6654641', 'n_tokens_mistral': 886, 'n_tokens_neox': 870, 'n_words': 165}