func (c *Config) ParseSettingsYAML(yamlData []byte, key string) (Settings, error) {
	var allSettings map[string]Settings
	if err := yaml.Unmarshal(yamlData, &allSettings); err != nil {
		return nil, fmt.Errorf("cannot parse settings data: %v", err)
	}
	settings, ok := allSettings[key]
	if !ok {
		return nil, fmt.Errorf("no settings found for %q", key)
	}
	out := make(Settings)
	for name, value := range settings {
		option, err := c.option(name)
		if err != nil {
			return nil, err
		}
		// Accept string values for compatibility with python.
		if str, ok := value.(string); ok {
			if value, err = option.parse(name, str); err != nil {
				return nil, err
			}
		} else if value, err = option.validate(name, value); err != nil {
			return nil, err
		}
		out[name] = value
	}
	return out, nil
}
// ParseSettingsYAML returns settings derived from the supplied YAML data. The
// YAML must unmarshal to a map of strings to settings data; the supplied key
// must be present in the map, and must point to a map in which every value
// must have, or be a string parseable to, the correct type for the associated
// config option. Empty strings and nil values are both interpreted as nil.
ParseSettingsYAML returns settings derived from the supplied YAML data. The
YAML must unmarshal to a map of strings to settings data; the supplied key
must be present in the map, and must point to a map in which every value
must have, or be a string parseable to, the correct type for the associated
config option. Empty strings and nil values are both interpreted as nil.
// ParseSettingsYAML returns settings derived from the supplied YAML data . The // YAML must unmarshal to a map of strings to settings data ; the supplied key // must be present in the map and must point to a map in which every value // must have or be a string parseable to the correct type for the associated // config option . Empty strings and nil values are both interpreted as nil .
func (c *Config) ParseSettingsYAML(yamlData []byte, key string) (Settings, error) {
	var allSettings map[string]Settings
	if err := yaml.Unmarshal(yamlData, &allSettings); err != nil {
		return nil, fmt.Errorf("cannot parse settings data: %v", err)
	}
	settings, ok := allSettings[key]
	if !ok {
		return nil, fmt.Errorf("no settings found for %q", key)
	}
	out := make(Settings)
	for name, value := range settings {
		option, err := c.option(name)
		if err != nil {
			return nil, err
		}
		if str, ok := value.(string); ok {
			if value, err = option.parse(name, str); err != nil {
				return nil, err
			}
		} else if value, err = option.validate(name, value); err != nil {
			return nil, err
		}
		out[name] = value
	}
	return out, nil
}
func ( c * Config ) ParseSettingsYAML ( yamlData [ ] byte , key string ) ( Settings , error ) { var allSettings map [ string ] Settings if err := yaml . Unmarshal ( yamlData , & allSettings ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } settings , ok := allSettings [ key ] if ! ok { return nil , fmt . Errorf ( " " , key ) } out := make ( Settings ) for name , value := range settings { option , err := c . option ( name ) if err != nil { return nil , err } if str , ok := value . ( string ) ; ok { if value , err = option . parse ( name , str ) ; err != nil { return nil , err } } else if value , err = option . validate ( name , value ) ; err != nil { return nil , err } out [ name ] = value } return out , nil }
ParseSettingsYAML returns settings derived from the supplied YAML data.
ParseSettingsYAML returns settings derived from the supplied YAML data .
// Accept string values for compatibility with python.