<commit_before>package main

import (
	"encoding/binary"

	"github.com/jmhodges/levigo"
)

func Set(args [][]byte, wb *levigo.WriteBatch) cmdReply {
	key := metaKey(args[0])
	res, err := DB.Get(DefaultReadOptions, key)
	if err != nil {
		return err
	}
	// If there is a non-string key here, let's delete it first
	if len(res) > 0 && res[0] != StringLengthValue {
		del(args[0], res[0], wb)
	}

	// store the string length in the metakey
	meta := res
	if len(res) != 5 {
		meta = make([]byte, 5)
	}
	meta[0] = StringLengthValue
	binary.BigEndian.PutUint32(meta[1:], uint32(len(args[1])))
	wb.Put(key, meta)

	// store the string
	wb.Put(stringKey(args[0]), args[1])

	return "OK"
}

func Get(args [][]byte, wb *levigo.WriteBatch) cmdReply {
	res, err := DB.Get(DefaultReadOptions, stringKey(args[0]))
	if err != nil {
		return err
	}
	return res
}

func DelString(key []byte, wb *levigo.WriteBatch) {
	wb.Delete(stringKey(key))
}

func stringKey(k []byte) []byte {
	key := make([]byte, 5+len(k))
	key[0] = StringKey
	binary.BigEndian.PutUint32(key[1:], uint32(len(k)))
	copy(key[5:], k)
	return key
}
<commit_msg>Add a list of missing string commands<commit_after>package main

import (
	"encoding/binary"

	"github.com/jmhodges/levigo"
)

func Set(args [][]byte, wb *levigo.WriteBatch) cmdReply {
	key := metaKey(args[0])
	res, err := DB.Get(DefaultReadOptions, key)
	if err != nil {
		return err
	}
	// If there is a non-string key here, let's delete it first
	if len(res) > 0 && res[0] != StringLengthValue {
		del(args[0], res[0], wb)
	}

	// store the string length in the metakey
	meta := res
	if len(res) != 5 {
		meta = make([]byte, 5)
	}
	meta[0] = StringLengthValue
	binary.BigEndian.PutUint32(meta[1:], uint32(len(args[1])))
	wb.Put(key, meta)

	// store the string
	wb.Put(stringKey(args[0]), args[1])

	return "OK"
}

func Get(args [][]byte, wb *levigo.WriteBatch) cmdReply {
	res, err := DB.Get(DefaultReadOptions, stringKey(args[0]))
	if err != nil {
		return err
	}
	return res
}

func DelString(key []byte, wb *levigo.WriteBatch) {
	wb.Delete(stringKey(key))
}

func stringKey(k []byte) []byte {
	key := make([]byte, 5+len(k))
	key[0] = StringKey
	binary.BigEndian.PutUint32(key[1:], uint32(len(k)))
	copy(key[5:], k)
	return key
}

// APPEND
// BITCOUNT
// BITOP
// DECR
// DECRBY
// GET
// GETBIT
// GETRANGE
// GETSET
// INCR
// INCRBY
// INCRBYFLOAT
// MGET
// MSET
// MSETNX
// PSETEX
// SET
// SETBIT
// SETEX
// SETNX
// SETRANGE
// STRLEN

{'fraction_non_alphanumeric': 0.1762078765732846, 'fraction_numerical': 0.020300446609825416, 'mean_word_length': 3.7567567567567566, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1711504', 'n_tokens_mistral': 1038, 'n_tokens_neox': 999, 'n_words': 242}