create a section based on key, value recipe pairs, 
       This is used for files or label

      Parameters
      ==========
      section: the list of values to return as a parsed list of lines
      name: the name of the section to write (e.g., files)
510963
def create_keyval_section(pairs, name):
    '''

    '''
    section = ['%' + name ]
    for pair in pairs:
        section.append(' '.join(pair).strip().strip('\\'))
    return section
268510
def preprocess_section(self, section):
    
    codeblock_opened = False
    current_section = None
    content = self._preprocess_refs(section)
    lines = []
    for line in content.split('\n'):
      if line.startswith("```"):
        codeblock_opened = (not codeblock_opened)
      if not line:
        current_section = None
      elif not codeblock_opened:
        line, current_section = self._preprocess_line(line, current_section)
      lines.append(line)
    section.content = '\n'.join(lines)
553102
async def section(self, sec=None):
        
        if self.writing:
            await dump_varint(self.iobj, len(sec))
            for key in sec:
                await self.section_name(key)
                await self.storage_entry(sec[key])

        else:
            sec = {} if sec is None else sec

            count = await load_varint(self.iobj)
            for idx in range(count):
                sec_name = await self.section_name()
                val = await self.storage_entry()
                sec[sec_name] = val

            return sec
236082
def get(self, section, key):
        
        line = self._make_line(key)
        for line in self.get_line(section, line):
            yield line.value
223156
def _set_key(self, key, value):
        

        if is_config_section(value):
            self.add_section(key, value)
            return

        if key not in self._tree or self.settings.key_setter is None:
            if is_config_item(value):
                self.add_item(key, value)
                return

            raise TypeError(
                'Section sections/items can only be replaced with sections/items, '
                'got {type}. To set value use ..[{name}].value = <new_value>'.format(
                    type=type(value),
                    name=key,
                )
            )

        if self.settings.key_setter is None:
            self._default_key_setter(key, value)
        else:
            self.settings.key_setter(subject=self._tree[key], value=value, default_key_setter=self._default_key_setter)
1135582
def _set(self, section, option, value, verbose):
        
        if not self.has_section(section):
            self.add_section( section )
        if not is_text_string(value):
            value = repr( value )
        if verbose:
            print('%s[ %s ] = %s' % (section, option, value))  # spyder: test-skip
        cp.ConfigParser.set(self, section, option, value)
38033
def items(self, section):
        
        self._read_sources()

        if section in self._dot_keys:
            section = self._dot_keys[section]

        for item in self._parser.items(section):
            key, value = item
            value = self._typed_value(value)
            yield (key, value)
298319
def sections(self, value):
        

        if value is not None:
            assert type(value) in (OrderedDict, dict), "'{0}' attribute: '{1}' type is not \
            'OrderedDict' or 'dict'!".format("sections", value)
            for key, element in value.iteritems():
                assert type(key) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                    "sections", key)
                assert type(element) in (OrderedDict, dict), "'{0}' attribute: '{1}' type is not \
                'OrderedDict' or 'dict'!".format("sections", key)
        self.__sections = value
1016744
def write_config_file_value(key, value):
    

    filename = get_config_file()

    config = _ConfigParser.SafeConfigParser()
    config.read(filename)

    __section = "Environment"

    if not(config.has_section(__section)):
        config.add_section(__section)

    config.set(__section, key, value)

    with open(filename, 'w') as config_file:
        config.write(config_file)
289420
def as_dict(self, section='Main', **kwargs):
        
        items = super(MakesiteParser, self).items(section, **kwargs)
        return dict(items)
1366285
def preprocess_section(self, section):
    
    lines = []
    in_codeblock = False
    keyword = None
    components = {}
    for line in section.content.split('\n'):
      line = line.strip()

      if line.startswith("```"):
        in_codeblock = not in_codeblock

      if not in_codeblock:
        match = re.match(r':(?:param|parameter)\s+(\w+)\s*:(.*)?$', line)
        if match:
          keyword = 'Arguments'
          param = match.group(1)
          text = match.group(2)
          text = text.strip()

          component = components.get(keyword, [])
          component.append('- `{}`: {}'.format(param, text))
          components[keyword] = component
          continue

        match = re.match(r':(?:return|returns)\s*:(.*)?$', line)
        if match:
          keyword = 'Returns'
          text = match.group(1)
          text = text.strip()

          component = components.get(keyword, [])
          component.append(text)
          components[keyword] = component
          continue

        match = re.match(':(?:raises|raise)\s+(\w+)\s*:(.*)?$', line)
        if match:
          keyword = 'Raises'
          exception = match.group(1)
          text = match.group(2)
          text = text.strip()

          component = components.get(keyword, [])
          component.append('- `{}`: {}'.format(exception, text))
          components[keyword] = component
          continue

      if keyword is not None:
        components[keyword].append(line)
      else:
        lines.append(line)

    for key in components:
      self._append_section(lines, key, components)

    section.content = '\n'.join(lines)
1091087
def from_file(filename, section='matrix'):
    
    config = parse_config(open(filename), section=section)
    return from_config(config)
73892
def section(self, section):
        
        # check if the named section exists
        if self.config.has_section(section):
            return (True, self.config.items(section))
        return (False, 'Section: ' + section + ' does not exist')
183313
def create_env_section(pairs, name):
    '''

    '''
    section = ['%' + name ]
    for pair in pairs:
        section.append("export %s" %pair)
    return section
233329
def parse_section(self, section_options):
        
        for (name, (_, value)) in section_options.items():
            try:
                self[name] = value

            except KeyError:
                pass
97743
def _load_config_section(self, section_name):
        
        if self._config.has_section(section_name):
            # Load specific section
            section = dict(self._config.items(section_name))
        elif self._config.has_section("Default"):
            # Load Default section
            section = dict(self._config.items("Default"))
        else:
            raise KeyError((
                "'{}' was not found in the configuration file and no default " +
                "configuration was provided."
            ).format(section_name))

        # Make sure section is valid
        if "protocol" in section and "host" in section and "token" in section:
            return section
        else:
            raise KeyError(
                "Missing values in configuration data. " +
                "Must contain: protocol, host, token"
            )
632355
def section(request):
    
    # If SECTIONS setting is not specified, don't do anything.
    try:
        sections = settings.SECTIONS
    except AttributeError:
        return {}

    # Default return is first section.
    section = sections[0]['name']

    try:
        pattern_name = resolve_to_name(request.path_info)
    except Resolver404:
        pattern_name = None

    if pattern_name:
        for option in settings.SECTIONS:
            if pattern_name in option['matching_pattern_names']:
                section = option['name']

    return {'section': section}