// Returns a named Section. A Section will be created if one does not already exist for the given name.
356958
func (f File) Section(name string) Section {
	section := f[name]
	if section == nil {
		section = make(Section)
		f[name] = section
	}
	return section
}
1498
func (s *Section) GetKey(name string) (*Key, error) {
	if s.f.BlockMode {
		s.f.lock.RLock()
	}
	if s.f.options.Insensitive {
		name = strings.ToLower(name)
	}
	key := s.keys[name]
	if s.f.BlockMode {
		s.f.lock.RUnlock()
	}

	if key == nil {
		// Check if it is a child-section.
		sname := s.name
		for {
			if i := strings.LastIndex(sname, "."); i > -1 {
				sname = sname[:i]
				sec, err := s.f.GetSection(sname)
				if err != nil {
					continue
				}
				return sec.GetKey(name)
			}
			break
		}
		return nil, fmt.Errorf("error when getting key of section '%s': key '%s' not exists", s.name, name)
	}
	return key, nil
}
1312975
func (section *Section) GetBoolean(name string) (bool, error) {
	value, err := section.Get(name)
	if err != nil {
		return false, err
	}

	switch value.(type) {
	case *Primative:
		return value.(*Primative).AsBoolean()
	case *Section:
		return true, nil
	}

	return false, errors.New("could not convert unknown value to boolean")
}
686030
func (f *File) SectionNames() []string {
	names := make([]string, len(f.sections))
	for i, s := range f.sections {
		names[i] = s.Name()
	}
	return names
}
657614
func (c *ConfigFile) DeleteSection(section string) bool {
	// Blank section name represents DEFAULT section.
	if len(section) == 0 {
		section = DEFAULT_SECTION
	}

	// Check if section exists.
	if _, ok := c.data[section]; !ok {
		return false
	}

	delete(c.data, section)
	// Remove comments of section.
	c.SetSectionComments(section, "")
	// Get index of section.
	i := 0
	for _, secName := range c.sectionList {
		if secName == section {
			break
		}
		i++
	}
	// Remove from section list.
	c.sectionList = append(c.sectionList[:i], c.sectionList[i+1:]...)
	return true
}
92949
func (s *Section) ChildSections() []*Section {
	prefix := s.name + "."
	children := make([]*Section, 0, 3)
	for _, name := range s.f.sectionList {
		if strings.HasPrefix(name, prefix) {
			children = append(children, s.f.sections[name])
		}
	}
	return children
}
120038
func ParseBodySectionName(s FetchItem) (*BodySectionName, error) {
	section := new(BodySectionName)
	err := section.parse(string(s))
	return section, err
}
935918
func (c *ConfigFile) GetSection(section string) (map[string]string, error) {
	// Blank section name represents DEFAULT section.
	if len(section) == 0 {
		section = DEFAULT_SECTION
	}

	// Check if section exists.
	if _, ok := c.data[section]; !ok {
		// Section does not exist.
		return nil, getError{ErrSectionNotFound, section}
	}

	// Remove pre-defined key.
	secMap := c.data[section]
	delete(c.data[section], " ")

	// Section exists.
	return secMap, nil
}
324025
func (t Sections) GetSection(p string) (Section, bool) {
	v, ok := t.container[p]
	return v, ok
}
1120394
func (f *File) ChildSections(name string) []*Section {
	return f.Section(name).ChildSections()
}
1354290
func (f *File) RenameSection(name, value string) {
	f.RenameSectionRaw(name, f.SectionManipFunc(value))
}
689828
func (c *Config) GetValue(section, name string) string {
	c.ReadList()
	conf := c.ReadList()
	for _, v := range conf {
		for key, value := range v {
			if key == section {
				return value[name]
			}
		}
	}
	return "no value"
}
383887
func NewEntitiesSection(tags core.TagSlice) (*EntitiesSection, error) {
	section := new(EntitiesSection)

	if len(tags) == 3 {
		return section, nil
	}

	entities, err := NewEntityList(core.TagGroups(tags[2:len(tags)-1], 0))
	if err != nil {
		return nil, err
	}
	section.Entities = entities

	return section, nil
}
88578
func (l *dynamicNamespaceLister) Get(name string) (*unstructured.Unstructured, error) {
	obj, exists, err := l.indexer.GetByKey(l.namespace + "/" + name)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(l.gvr.GroupResource(), name)
	}
	return obj.(*unstructured.Unstructured), nil
}
890143
func (section *Section) GetList(name string) (*List, error) {
	value, err := section.Get(name)
	if err != nil {
		return nil, err
	}

	if value.GetType() == LIST {
		return value.(*List), nil
	}

	return nil, errors.New("could not fetch value as list")
}
1186348
func (ini *INI) SectionGetBool(section, key string) (bool, bool) {
    v, ok := ini.SectionGet(section, key)
    if ok {
        switch v {
        case "1", "t", "T", "true", "TRUE", "True", "on", "ON", "On", "yes", "YES", "Yes":
            return true, true
        case "0", "f", "F", "false", "FALSE", "False", "off", "OFF", "Off", "no", "NO", "No":
            return false, true
        }
    }

    return false, false
}
86148
func (s *Section) NewKey(name, val string) (*Key, error) {
	if len(name) == 0 {
		return nil, errors.New("error creating new key: empty key name")
	} else if s.f.options.Insensitive {
		name = strings.ToLower(name)
	}

	if s.f.BlockMode {
		s.f.lock.Lock()
		defer s.f.lock.Unlock()
	}

	if inSlice(name, s.keyList) {
		if s.f.options.AllowShadows {
			if err := s.keys[name].addShadow(val); err != nil {
				return nil, err
			}
		} else {
			s.keys[name].value = val
			s.keysHash[name] = val
		}
		return s.keys[name], nil
	}

	s.keyList = append(s.keyList, name)
	s.keys[name] = newKey(s, name, val)
	s.keysHash[name] = val
	return s.keys[name], nil
}