<commit_before>package bucketeer

import (
	"encoding"
	"encoding/binary"
	"encoding/json"

	"github.com/boltdb/bolt"
)

type Key interface {
	KeyBytes() []byte
}

type ByteKey []byte

func (k ByteKey) KeyBytes() []byte {
	return k
}

type StringKey string

func (k StringKey) KeyBytes() []byte {
	return []byte(k)
}

type Uint64Key uint64

func (k Uint64Key) KeyBytes() (b []byte) {
	b = make([]byte, 8)
	binary.BigEndian.PutUint64(b, uint64(k))
	return
}

type Int64Key int64

func (k Int64Key) KeyBytes() (b []byte) {
	b = make([]byte, 8)
	k2 := uint64(1<<63) ^ uint64(k)
	binary.BigEndian.PutUint64(b, k2)
	return
}

type TextKey struct {
	encoding.TextMarshaler
}

func (k TextKey) KeyBytes() (b []byte) {
	b, _ = k.MarshalText()
	return
}

type BinaryKey struct {
	encoding.BinaryMarshaler
}

func (k BinaryKey) KeyBytes() (b []byte) {
	b, _ = k.MarshalBinary()
	return
}

type JsonKey struct {
}

func (k JsonKey) KeyBytes() (b []byte) {
	b, _ = json.Marshal(k)
	return
}

/*
Keyfarer encapsulates the components needed to resolve a key in BoltDB and provides convenience methods for setting and retrieving the value
*/
type Keyfarer struct {
	bb  *Bucketeer
	key []byte
}

func NewKeyfarer(bb *Bucketeer, key []byte) (kf *Keyfarer) {
	kf = &Keyfarer{
		bb:  bb,
		key: key,<commit_msg>- restoring panic for these<commit_after>package bucketeer

import (
	"encoding"
	"encoding/binary"
	"encoding/json"

	"github.com/boltdb/bolt"
)

type Key interface {
	KeyBytes() []byte
}

type ByteKey []byte

func (k ByteKey) KeyBytes() []byte {
	return k
}

type StringKey string

func (k StringKey) KeyBytes() []byte {
	return []byte(k)
}

type Uint64Key uint64

func (k Uint64Key) KeyBytes() (b []byte) {
	b = make([]byte, 8)
	binary.BigEndian.PutUint64(b, uint64(k))
	return
}

type Int64Key int64

func (k Int64Key) KeyBytes() (b []byte) {
	b = make([]byte, 8)
	k2 := uint64(1<<63) ^ uint64(k)
	binary.BigEndian.PutUint64(b, k2)
	return
}

type TextKey struct {
	encoding.TextMarshaler
}

func (k TextKey) KeyBytes() (b []byte) {
	var err error
	if b, err = k.MarshalText(); err != nil {
		panic(err.Error())
	}
	return
}

type BinaryKey struct {
	encoding.BinaryMarshaler
}

func (k BinaryKey) KeyBytes() (b []byte) {
	var err error
	if b, err = k.MarshalBinary(); err != nil {
		panic(err.Error())
	}
	return
}

type JsonKey struct {
}

func (k JsonKey) KeyBytes() (b []byte) {
	var err error
	if b, err = json.Marshal(k); err != nil {
		panic(err.Error())
	}
	return
}

/*
Keyfarer encapsulates the components needed to resolve a key in BoltDB and provides convenience methods for setting and retrieving the value
*/
type Keyfarer struct {
	bb  *Bucketeer
	key []byte
}

func NewKeyfarer(bb *Bucketeer, key []byte) (kf *Keyfarer) {
	kf = &Keyfarer{
		bb:  bb,
		key: key,
{'fraction_non_alphanumeric': 0.1395097332372026, 'fraction_numerical': 0.02090843547224225, 'mean_word_length': 4.054644808743169, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6547790', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1076, 'n_words': 315}