<commit_before>package requests

import (
	"errors"
	"fmt"
	"reflect"
	"strconv"
)

// set is a simple slice of unique strings.
type set []string

// add appends a variadic amount of strings to a set, returning the
// resulting set.  Duplicates will only exist once in the resulting
// set.
func (s set) add(values ...string) set {
	for _, newValue := range values {
		exists := false
		for _, value := range s {
			if newValue == value {
				exists = true
				break
			}
		}
		if !exists {
			s = append(s, newValue)
		}
	}
	return s
}

// UnmarshalParams unmarshals a request to a struct, using field tags
// to locate corresponding values in the request and check/parse them
// before assigning them to struct fields.  It acts similar to json's
// Unmarshal when used on a struct, but works with any codec
// registered with AddCodec().  Field tags are used as follows:
//
// * All field tags are considered to be of the format
// name,option1,option2,...
// * Options will *only* be parsed from the "request" tag.
// * By default, name will only be checked in the "request" tag, but
// you can add fallback tag names using AddFallbackTag.
// * If no non-empty name is found using field tags, the lowercase
// field name will be used instead.
// * Once a name is found, if the name is "-", then the field will be
// treated as if it does not exist.
//
// For an explanation on how options work, see the documentation for
// RegisterOption.  For a list of tag options built in to this
// library, see the options package in this package.
//
// Fields which implement Receiver will have their Receive method<commit_msg>Documentation update, part 5<commit_after>package requests

import (
	"errors"
	"fmt"
	"reflect"
	"strconv"
)

// set is a simple slice of unique strings.
type set []string

// add appends a variadic amount of strings to a set, returning the
// resulting set.  Duplicates will only exist once in the resulting
// set.
func (s set) add(values ...string) set {
	for _, newValue := range values {
		exists := false
		for _, value := range s {
			if newValue == value {
				exists = true
				break
			}
		}
		if !exists {
			s = append(s, newValue)
		}
	}
	return s
}

// Unmarshal unmarshals a request to a struct, using field tags to
// locate corresponding values in the request and check/parse them
// before assigning them to struct fields.  It acts similar to json's
// Unmarshal when used on a struct, but works with any codec
// registered with AddCodec().  Field tags are used as follows:
//
// * All field tags are considered to be of the format
// name,option1,option2,...
// * Options will *only* be parsed from the "request" tag.
// * By default, name will only be checked in the "request" tag, but
// you can add fallback tag names using AddFallbackTag.
// * If no non-empty name is found using field tags, the lowercase
// field name will be used instead.
// * Once a name is found, if the name is "-", then the field will be
// treated as if it does not exist.
//
// For an explanation on how options work, see the documentation for
// RegisterOption.  For a list of tag options built in to this
// library, see the options package in this package.
//
// Fields which implement Receiver will have their Receive method
{'fraction_non_alphanumeric': 0.08956602031394276, 'fraction_numerical': 0.0015389350569405972, 'mean_word_length': 3.04228855721393, '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': '3771913', 'n_tokens_mistral': 960, 'n_tokens_neox': 908, 'n_words': 478}