<commit_before>package config

import (
	"fmt"
	"reflect"
	"strings"
)

type ServiceConfig map[string]interface{}

func (sc ServiceConfig) Assign(to interface{}) error {
	t := reflect.TypeOf(to)
	v := reflect.ValueOf(to)
	if v.Kind() != reflect.Struct {
		return fmt.Errorf("TODO implement error type for when interface is not a struct")
	}
	fc := t.NumField()
	for i := 0; i < fc; i++ {
		tf := t.Field(i)
		if tf.Anonymous {
			continue
		}

		if !v.CanSet() {
			continue
		}
		tag, ok := tf.Tag.Lookup("servconf")
		if !ok {
			continue
		}
		vf := v.Field(i)
		sc.handleField(tag, &vf)

	}

	return nil
}

func (sc ServiceConfig) handleField(tag string, vf *reflect.Value) error {
	tagVals := strings.Split(tag, ",")
	tvc := len(tagVals)
	if tvc < 1 {
		return fmt.Errorf("TODO implement error type for invalid struct fields")
	}
<commit_msg>config.ServiceConfig: Remove unneeded sanity check<commit_after>package config

import (
	"fmt"
	"reflect"
	"strings"
)

type ServiceConfig map[string]interface{}

func (sc ServiceConfig) Assign(to interface{}) error {
	t := reflect.TypeOf(to)
	v := reflect.ValueOf(to)
	if v.Kind() != reflect.Struct {
		return fmt.Errorf("TODO implement error type for when interface is not a struct")
	}
	fc := t.NumField()
	for i := 0; i < fc; i++ {
		tf := t.Field(i)
		if tf.Anonymous {
			continue
		}

		if !v.CanSet() {
			continue
		}
		tag, ok := tf.Tag.Lookup("servconf")
		if !ok {
			continue
		}
		vf := v.Field(i)
		sc.handleField(tag, &vf)

	}

	return nil
}

func (sc ServiceConfig) handleField(tag string, vf *reflect.Value) error {
	tagVals := strings.Split(tag, ",")
	tvc := len(tagVals)

{'fraction_non_alphanumeric': 0.14887126296522268, 'fraction_numerical': 0.0018303843807199512, 'mean_word_length': 3.5555555555555554, 'pattern_counts': {'":': 0, '<': 6, '<?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': '3591682', 'n_tokens_mistral': 656, 'n_tokens_neox': 607, 'n_words': 164}