<commit_before>package bundled

import (
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"strings"
)

// Inject overwrites bundled assets with versions from dir. Not all
// assets must be overwritten at once, i.e. just supplying a modified
// header.tmpl is perfectly fine.
func Inject(dir string) error {
	f, err := os.Open(dir)
	if err != nil {
		return err
	}
	defer f.Close()
	names, err := f.Readdirnames(-1)
	if err != nil {
		return err
	}
	for _, fn := range names {
		path := filepath.Join(dir, fn)
		b, err := ioutil.ReadFile(path)
		if err != nil {
			return err<commit_msg>inject: only consider regular files<commit_after>package bundled

import (
	"io/ioutil"
	"log"
	"os"
	"path/filepath"
	"strings"
)

// Inject overwrites bundled assets with versions from dir. Not all
// assets must be overwritten at once, i.e. just supplying a modified
// header.tmpl is perfectly fine.
func Inject(dir string) error {
	f, err := os.Open(dir)
	if err != nil {
		return err
	}
	defer f.Close()
	entries, err := f.Readdir(-1)
	if err != nil {
		return err
	}
	for _, fi := range entries {
		if !fi.Mode().IsRegular() {
			continue
		}
		fn := fi.Name()
		path := filepath.Join(dir, fn)
		b, err := ioutil.ReadFile(path)
		if err != nil {
			return err
{'fraction_non_alphanumeric': 0.132317562149158, 'fraction_numerical': 0.0016038492381716118, 'mean_word_length': 3.1739130434782608, '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': '210262', 'n_tokens_mistral': 483, 'n_tokens_neox': 454, 'n_words': 148}