<commit_before>package main

import (
	"fmt"
	"github.com/dustin/go-humanize"
	"time"
)

type CommandLineArgs struct {
	port       int
	host       string
	verbose    bool
	content    string
	headers    []string
	deadTime   string
	minWait    string
	maxWait    string
	randomWait bool
	minSize    string
	maxSize    string
	randomSize bool
}

type ConfigurationReader interface {
	Read() Configuration
}

type ArgsConfigurationReader struct {
	args        CommandLineArgs
	defaultTime time.Duration
}

func (instance *ArgsConfigurationReader) Read() Configuration {
	config := Configuration{}
	config.port = instance.args.port
	config.host = instance.args.host
	config.verbose = instance.args.verbose
	config.content = instance.args.content
	config.headers = instance.args.headers
	config.deadTime = parseTime(instance.args.deadTime)
	config.minWait = parseTime(instance.args.minWait)
	config.maxWait = parseTime(instance.args.maxWait)
	config.randomWait = instance.args.randomWait
	config.minSize = parseSize(instance.args.minSize)
	config.maxSize = parseSize(instance.args.maxSize)
	config.randomSize = instance.args.randomSize
	return config
}

func parseTime(value string) time.Duration {
	parsedDeadTime, err := time.ParseDuration(value)
	if err != nil {
		//This should be A) tested and B) use panic and correctly propogate errors
		fmt.Errorf("cannot parse time from string value")
	}
	return parsedDeadTime
}

func parseSize(value string) uint64 {
	parsedValue, err := humanize.ParseBytes(value)
	if err != nil {
		//This should be A) tested and B) use panic and correctly propogate errors
		fmt.Errorf("cannot parse size from string value")
	}
	return parsedValue
}

func NewArgsConfigurationReader(args CommandLineArgs) *ArgsConfigurationReader {
	return &ArgsConfigurationReader{args, 5 * time.Second}
}

type Configuration struct {
	port       int
	host       string
	verbose    bool
	content    string
	headers    []string
	deadTime   time.Duration
	minWait    time.Duration
	maxWait    time.Duration
	randomWait bool
	minSize    uint64
	maxSize    uint64
	randomSize bool
}

func (instance *Configuration) Snoozer() Snoozer {
	if *randomSleep {
		return NewRandomSnoozer(instance.minWait, instance.maxWait)
	} else {
		return NewMaxSnoozer(maxSleepValue)
	}
}

func createResponseBodyGenerator() ResponseBodyGenerator {
	minSizeValue, minSizeErr := humanize.ParseBytes(*minSize)
	maxSizeValue, maxSizeErr := humanize.ParseBytes(*maxSize)

	if minSizeErr != nil || maxSizeErr != nil {
		fmt.Errorf("Invalid size specified for min or max size")
		os.Exit(1)
	}

	if *randomSize {
		return NewRandomResponseBodyGenerator(int(minSizeValue), int(maxSizeValue))
	} else {
		return NewMaxResponseBodyGenerator(int(maxSizeValue))
	}
}<commit_msg>Removing the methods from the cofiguration<commit_after>package main

import (
	"fmt"
	"github.com/dustin/go-humanize"
	"time"
)

type CommandLineArgs struct {
	port       int
	host       string
	verbose    bool
	content    string
	headers    []string
	deadTime   string
	minWait    string
	maxWait    string
	randomWait bool
	minSize    string
	maxSize    string
	randomSize bool
}

type ConfigurationReader interface {
	Read() Configuration
}

type ArgsConfigurationReader struct {
	args        CommandLineArgs
	defaultTime time.Duration
}

func (instance *ArgsConfigurationReader) Read() Configuration {
	config := Configuration{}
	config.port = instance.args.port
	config.host = instance.args.host
	config.verbose = instance.args.verbose
	config.content = instance.args.content
	config.headers = instance.args.headers
	config.deadTime = parseTime(instance.args.deadTime)
	config.minWait = parseTime(instance.args.minWait)
	config.maxWait = parseTime(instance.args.maxWait)
	config.randomWait = instance.args.randomWait
	config.minSize = parseSize(instance.args.minSize)
	config.maxSize = parseSize(instance.args.maxSize)
	config.randomSize = instance.args.randomSize
	return config
}

func parseTime(value string) time.Duration {
	parsedDeadTime, err := time.ParseDuration(value)
	if err != nil {
		//This should be A) tested and B) use panic and correctly propogate errors
		fmt.Errorf("cannot parse time from string value")
	}
	return parsedDeadTime
}

func parseSize(value string) uint64 {
	parsedValue, err := humanize.ParseBytes(value)
	if err != nil {
		//This should be A) tested and B) use panic and correctly propogate errors
		fmt.Errorf("cannot parse size from string value")
	}
	return parsedValue
}

func NewArgsConfigurationReader(args CommandLineArgs) *ArgsConfigurationReader {
	return &ArgsConfigurationReader{args, 5 * time.Second}
}

type Configuration struct {
	port       int
	host       string
	verbose    bool
	content    string
	headers    []string
	deadTime   time.Duration
	minWait    time.Duration
	maxWait    time.Duration
	randomWait bool
	minSize    uint64
	maxSize    uint64
	randomSize bool
}
{'fraction_non_alphanumeric': 0.07971311475409835, 'fraction_numerical': 0.0030737704918032786, 'mean_word_length': 4.242749731471536, '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': '4690971', 'n_tokens_mistral': 1496, 'n_tokens_neox': 1468, 'n_words': 399}