<commit_before>package cete

import (
	"errors"
	"os"
	"sync"

	"github.com/dgraph-io/badger/badger"
	"gopkg.in/vmihailenco/msgpack.v2"
)

type indexConfig struct {
	IndexName string
}

type tableConfig struct {
	TableName string
	Indexes   []indexConfig
}

type dbConfig struct {
	Tables []tableConfig
}

func (d *DB) newKV(names ...Name) (*badger.KV, error) {
	dir := d.path

	for _, name := range names {
		dir += "/" + name.Hex()
	}

	dir += "/data"

	if found, _ := exists(dir); !found {
		if err := os.MkdirAll(dir, 0744); err != nil {
			return nil, err
		}
	}

	opts := badger.DefaultOptions
	opts.Dir = dir
	opts.ValueDir = dir
	return badger.NewKV(&opts)
}

// OpenDatabase opens the database at the provided path. It will create a new
// database if the folder does not exist.
func Open(path string) (*DB, error) {
	db := &DB{
		path:        path,
		tables:      make(map[Name]*Table),
		configMutex: new(sync.Mutex),
	}

	if ex, _ := exists(path); !ex {
		if err := os.MkdirAll(path, 0744); err != nil {<commit_msg>Fix comment name for Open<commit_after>package cete

import (
	"errors"
	"os"
	"sync"

	"github.com/dgraph-io/badger/badger"
	"gopkg.in/vmihailenco/msgpack.v2"
)

type indexConfig struct {
	IndexName string
}

type tableConfig struct {
	TableName string
	Indexes   []indexConfig
}

type dbConfig struct {
	Tables []tableConfig
}

func (d *DB) newKV(names ...Name) (*badger.KV, error) {
	dir := d.path

	for _, name := range names {
		dir += "/" + name.Hex()
	}

	dir += "/data"

	if found, _ := exists(dir); !found {
		if err := os.MkdirAll(dir, 0744); err != nil {
			return nil, err
		}
	}

	opts := badger.DefaultOptions
	opts.Dir = dir
	opts.ValueDir = dir
	return badger.NewKV(&opts)
}

// Open opens the database at the provided path. It will create a new
// database if the folder does not exist.
func Open(path string) (*DB, error) {
	db := &DB{
		path:        path,
		tables:      make(map[Name]*Table),
		configMutex: new(sync.Mutex),
	}

	if ex, _ := exists(path); !ex {
		if err := os.MkdirAll(path, 0744); err != nil {
{'fraction_non_alphanumeric': 0.14868804664723032, 'fraction_numerical': 0.008746355685131196, 'mean_word_length': 3.2279260780287475, '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': '1702423', 'n_tokens_mistral': 822, 'n_tokens_neox': 781, 'n_words': 216}