<commit_before>package main

const TPL = `package {{ .Package }}

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
)

var assets = map[string][]byte{}

func Names() (names []string) {
	for name, _ := range assets {
		names = append(names, name)
	}
	return names
}

var (
	devAssetsPath string
	Development bool
)

func init() {
	devAssetsPath = os.Getenv("DEV_ASSETS_PATH")
	if devAssetsPath != "" {
		Development = true
	}
}

func Get(key string) ([]byte, error) {
	if devAssetsPath != "" {
		return ioutil.ReadFile(devAssetsPath + "/" + key)
	}
	b, ok := assets[key]
	if !ok {
		return nil, fmt.Errorf("asset %s not found in %v", key, Names())
	}
	gz, err := gzip.NewReader(bytes.NewBuffer(b))
	if err != nil {
		return nil, fmt.Errorf("Decompression failed: %s", err.Error())
	}

	var buf bytes.Buffer
	io.Copy(&buf, gz)
	gz.Close()
	return buf.Bytes(), nil
}

func init() {
	{{ range .Assets }}assets["{{ .Name }}"] = []byte{
{{ .Bytes }}
	}
	{{ end }}
}
`
<commit_msg>add debug flag for goassets handling<commit_after>package main

const TPL = `package {{ .Package }}

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"io/ioutil"
	"os"
)

var assets = map[string][]byte{}

func Names() (names []string) {
	for name, _ := range assets {
		names = append(names, name)
	}
	return names
}

var (
	devAssetsPath string
	Development bool
	Debug bool
)

func init() {
	devAssetsPath = os.Getenv("DEV_ASSETS_PATH")
	if devAssetsPath != "" {
		Development = true
	}
}

func logDebug(format string, args ...interface{}) {
	if Debug {
		fmt.Printf(format + "\n", args...)
	}
}

func Get(key string) ([]byte, error) {
	if devAssetsPath != "" {
		path := devAssetsPath + "/" + key
		logDebug("reading file from dev path %s", path)
		return ioutil.ReadFile(path)
	}
	b, ok := assets[key]
	if !ok {
		return nil, fmt.Errorf("asset %s not found in %v", key, Names())
	}
	gz, err := gzip.NewReader(bytes.NewBuffer(b))
	if err != nil {
		return nil, fmt.Errorf("Decompression failed: %s", err.Error())
	}

	var buf bytes.Buffer
	io.Copy(&buf, gz)
	gz.Close()
	return buf.Bytes(), nil
}

func init() {
	{{ range .Assets }}assets["{{ .Name }}"] = []byte{
{{ .Bytes }}
	}
	{{ end }}
}
`

{'fraction_non_alphanumeric': 0.18136135221562358, 'fraction_numerical': 0.0, 'mean_word_length': 3.591194968553459, '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': '2840485', 'n_tokens_mistral': 888, 'n_tokens_neox': 858, 'n_words': 220}