Check format of user-provided 'sections' variable
481282
def _chk_sections(sections):
        """"""
        if sections:
            assert len(sections[0]) == 2, \
                "SECTIONS DATA MUST BE A 2-D LIST. FOUND: {S}".format(S=sections)
            for _, hdrgos in sections:
                chk_goids(hdrgos, "HdrgosSections::_chk_sections()")
233329
def parse_section(self, section_options):
        
        for (name, (_, value)) in section_options.items():
            try:
                self[name] = value

            except KeyError:
                pass
761717
def get_assessment_section_mdata():
    """"""
    return {
        'assessment_taken': {
            'element_label': {
                'text': 'assessment taken',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'instructions': {
                'text': 'accepts an osid.id.Id object',
                'languageTypeId': str(DEFAULT_LANGUAGE_TYPE),
                'scriptTypeId': str(DEFAULT_SCRIPT_TYPE),
                'formatTypeId': str(DEFAULT_FORMAT_TYPE),
            },
            'required': False,
            'read_only': False,
            'linked': False,
            'array': False,
            'default_id_values': [''],
            'syntax': 'ID',
            'id_set': [],
        },
    }
671925
def details_section
    lazy_var :@details_section do
      # No details if we have nothing to work with
      if details.nil?
        nil
      else
        contents = case details
        when Proc
          details.call.to_s
        when String
          details
        else
          details.to_s
        end
        
        if contents.empty?
          nil
        else
          if @binding
            contents = binding.n_x.erb contents
          end
          
          "# Details\n\n" + contents
        end
      end
    end
  end
992676
private function _checkEncapsedVariablesInsideString() {
		if ($this->_isActive('encapsedVariablesInsideString') && (!$this->statementStack->getCurrentStackItem()->inHeredoc || ($this->_inFuncCall && !$this->_config->isException('encapsedVariablesInsideString', end($this->_currentFuncCall))))) {
			$this->_writeError('encapsedVariablesInsideString', $this->_getMessage('VARIABLE_INSIDE_STRING'));
		}
	}
676309
def values(self, section=None):
        """"""
        if not section and self.section:
            section = self.section
        config = self.config.get(section, {}) if section else self.config
        return config.values()
607392
def section(self, section, skip=['type', 'order']):
        
        return [(key, val) for key, val in self.parser.items(section)
                if key not in skip]
35416
def format(self, formatstring, *args):
        """"""

        # Make a new section
        if self.incoming_section:
            self.SendMessage(['s', {'name': args}])
            self.incoming_section = False
245856
def _get_section_name(cls, parser):
        """"""
        for section_name in cls.POSSIBLE_SECTION_NAMES:
            if parser.has_section(section_name):
                return section_name

        return None
1166048
def guess_format(path):
    """"""
    for fmt in formats:
        if fmt.verify(path):
            return fmt.__name__
    else:
        msg = "Undefined file format: '{}'".format(path)
        raise UnknownFileFormatError(msg)
484421
def read_sections(sections_file, exclude_ungrouped=False, prt=sys.stdout):
    """"""
    if sections_file is None:
        return None
    assert isinstance(sections_file, str), "BAD SECTIONS FILENAME({S})".format(
        S=sections_file)
    if os.path.exists(sections_file):
        return ReadGoids().read_sections(sections_file, False, exclude_ungrouped)
    # Is 'sections_file' a module string?
    if '/' not in sections_file and r'\\' not in sections_file and \
            pkgutil.find_loader(sections_file) is not None:
        mod = importlib.import_module(sections_file)
        var = getattr(mod, 'SECTIONS', None)
        if var is not None:
            dat = SummarySec2dHdrGos().summarize_sec2hdrgos(var)
            print(Grouper.fmtsum.format(
                GO_DESC='hdr', SECs=len(dat['S']), GOs=len(dat['G']),
                UNGRP="N/A", undesc="unused", ACTION="IMPORTED: ", FILE=sections_file))
            return var
        raise RuntimeError("NO 'SECTIONS' VARIABLE FOUND IN MODULE({M})".format(M=sections_file))
    if prt:
        prt.write("CANNOT READ: {SEC}\n".format(SEC=sections_file))
926714
def check_format(formats, input)
      formats.inject(true) do |result, (key, format)|
        format.call(input[key]) && result
      end
    end
44480
def get_dump(self):
  """"""
  res = []
  for section in self.sections():
   sec = []
   for option in self.options(section):
    sec.append([option, self.get(section, option)])
   res.append([section, sec])
  return res
832368
def r_sa_check(template, tag_type, is_standalone):
    """"""

    # Check right side if we might be a standalone
    if is_standalone and tag_type not in ['variable', 'no escape']:
        on_newline = template.split('\n', 1)

        # If the stuff to the right of us are spaces we're a standalone
        if on_newline[0].isspace() or not on_newline[0]:
            return True
        else:
            return False

    # If we're a tag can't be a standalone
    else:
        return False
1347761
function(obj, section, options = {}) {
    var children, dotSplit, out, safe;
    if (arguments.length === 2) {
      options = section;
      section = void 0;
    }
    if (options.separator == null) {
      options.separator = ' = ';
    }
    if (options.eol == null) {
      options.eol = !options.ssh && process.platform === "win32" ? "\r\n" : "\n";
    }
    if (options.escape == null) {
      options.escape = true;
    }
    safe = module.exports.safe;
    dotSplit = module.exports.dotSplit;
    children = [];
    out = "";
    Object.keys(obj).forEach(function(k, _, __) {
      var val;
      val = obj[k];
      if (val && Array.isArray(val)) {
        return val.forEach(function(item) {
          return out += safe(`${k}[]`) + options.separator + safe(item) + options.eol;
        });
      } else if (val && typeof val === "object") {
        return children.push(k);
      } else if (typeof val === 'boolean') {
        if (val === true) {
          return out += safe(k) + options.eol;
        } else {

        }
      } else {
        // disregard false value
        return out += safe(k) + options.separator + safe(val) + options.eol;
      }
    });
    if (section && out.length) {
      out = "[" + safe(section) + "]" + options.eol + out;
    }
    children.forEach((k, _, __) => {
      var child, nk;
      // escape the section name dot as some daemon could not parse it
      nk = options.escape ? dotSplit(k).join('\\.') : k;
      child = module.exports.stringify(obj[k], (section ? section + "." : "") + nk, options);
      if (out.length && child.length) {
        out += options.eol;
      }
      return out += child;
    });
    return out;
  }
668453
def get_all_used_vars(section):
    ''''''
    all_used_vars = set()
    for statement in section.statements:
        if statement[0] == '=':
            all_used_vars |= accessed_vars('='.join(statement[1:3]))
        elif statement[0] == '!':
            all_used_vars |= accessed_vars(statement[1])
        elif statement[0] == ':':
            all_used_vars |= accessed_vars(statement[2], mode='eval')
            if statement[1] != 'input':
                continue
            if 'paired_with' in statement[2]:
                try:
                    pws = get_names_of_param(
                        'paired_with',
                        statement[2],
                        extra_dict=env.sos_dict.dict())
                    all_used_vars |= set(pws)
                except Exception as e:
                    raise ValueError(
                        f'Failed to parse parameter paired_with: {e}')
            if 'group_with' in statement[2]:
                try:
                    pws = get_names_of_param(
                        'group_with',
                        statement[2],
                        extra_dict=env.sos_dict.dict())
                    all_used_vars |= set(pws)
                except Exception as e:
                    raise ValueError(
                        f'Failed to parse parameter group_with: {e}')
            if 'for_each' in statement[2]:
                try:
                    pws = get_names_of_param(
                        'for_each',
                        statement[2],
                        extra_dict=env.sos_dict.dict())
                    for pw in pws:
                        all_used_vars |= set(pw.split(','))
                except Exception as e:
                    raise ValueError(f'Failed to parse parameter for_each: {e}')
    if section.task:
        all_used_vars |= accessed_vars(section.task)

    # now we have a list of global variables that are actually used in the functions
    # this is specifically designed to handle the last case in #1225
    func_with_vars = [
        y for x, y in used_in_func(section.global_stmts).items()
        if x in all_used_vars
    ]
    return set.union(all_used_vars, *func_with_vars)
946754
def _validate_sections(cls, sections):
        """"""
        names = []
        for section in sections:

            if not hasattr(section, 'name'):
                raise ConfigurationError('`sections` attribute requires a list of Section')

            name = section.name
            if name in names:
                raise ConfigurationError('`%s` section name must be unique' % name)

            names.append(name)