<commit_before>package phoenix

import (
	"code.google.com/p/goconf/conf"
)

// Config provides read access to the application's configuration.
type Config interface {
	GetBool(section, option string) (bool, error)
	GetInt(section, option string) (int, error)
	GetFloat64(section, option string) (float64, error)
	GetString(section, option string) (string, error)
}

type config struct {
	*conf.ConfigFile
	path string
	Defaults, Overrides *conf.ConfigFile
}

func newConfig() *config {
	return &config{
		ConfigFile: conf.NewConfigFile(),
		Defaults:  conf.NewConfigFile(),
		Overrides: conf.NewConfigFile(),
	}
}

func (config *config) HasPath() bool {
	return config.path != ""
}

func (config *config) Path() string {
	return config.path
}

func (config *config) SetPath(path string) {
	config.path = path<commit_msg>Add support for fetching configuration values with a default.<commit_after>package phoenix

import (
	"code.google.com/p/goconf/conf"
)

// Config provides read access to the application's configuration.
//
// GetXXXDefault methods return dflt if the named option in section has no
// value. Use HasOption to determine the status of an option thus defaulted.
type Config interface {
	HasOption(section, option string) bool
	GetBool(section, option string) (bool, error)
	GetBoolDefault(section, option string, dflt bool) bool
	GetInt(section, option string) (int, error)
	GetIntDefault(section, option string, dflt int) int
	GetFloat64(section, option string) (float64, error)
	GetFloat64Default(section, option string, dflt float64) float64
	GetString(section, option string) (string, error)
	GetStringDefault(section, option, dflt string) string
}

type config struct {
	*conf.ConfigFile
	path string
	Defaults, Overrides *conf.ConfigFile
}

func newConfig() *config {
	return &config{
		ConfigFile: conf.NewConfigFile(),
		Defaults:  conf.NewConfigFile(),
		Overrides: conf.NewConfigFile(),
	}
}

func (config *config) GetBoolDefault(section, option string, dflt bool) bool {
	if value, err := config.GetBool(section, option); err == nil {
		return value
	}
	return dflt
}

func (config *config) GetIntDefault(section, option string, dflt int) int {
	if value, err := config.GetInt(section, option); err == nil {
		return value
	}
	return dflt
}

func (config *config) GetFloat64Default(section, option string, dflt float64) float64 {
	if value, err := config.GetFloat64(section, option); err == nil {
		return value
	}
	return dflt
}

func (config *config) GetStringDefault(section, option, dflt string) string {
	if value, err := config.GetString(section, option); err == nil {
		return value
	}
	return dflt
}

func (config *config) HasPath() bool {
	return config.path != ""
}

func (config *config) Path() string {
	return config.path
}

func (config *config) SetPath(path string) {
	config.path = path
{'fraction_non_alphanumeric': 0.11020840692334864, 'fraction_numerical': 0.007771105616389968, 'mean_word_length': 4.9, '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': '1390346', 'n_tokens_mistral': 920, 'n_tokens_neox': 901, 'n_words': 289}