def _load(self, source):  # pylint: disable=too-many-branches
        try:
            raw = self._load_raw_from_source(source)
        except __HOLE__ as e:
            name = getattr(source, 'name', '')
            raise ConfigError('Error parsing agenda {}: {}'.format(name, e))
        if not isinstance(raw, dict):
            message = '{} does not contain a valid agenda structure; top level must be a dict.'
            raise ConfigError(message.format(self.filepath))
        for k, v in raw.iteritems():
            if v is None:
                raise ConfigError('Empty "{}" entry in {}'.format(k, self.filepath))

            if k == 'config':
                if not isinstance(v, dict):
                    raise ConfigError('Invalid agenda: "config" entry must be a dict')
                self.config = v
            elif k == 'global':
                self.global_ = AgendaGlobalEntry(**v)
            elif k == 'sections':
                self._collect_existing_ids(v, 'section')
                for s in v:
                    if not isinstance(s, dict):
                        raise ConfigError('Invalid section entry: "{}" in {}'.format(s, self.filepath))
                    self._collect_existing_ids(s.get('workloads', []), 'workload')
                for s in v:
                    self._assign_id_if_needed(s, 'section')
                    self.sections.append(AgendaSectionEntry(self, **s))
            elif k == 'workloads':
                self._collect_existing_ids(v, 'workload')
                for w in v:
                    self.workloads.append(self.get_workload_entry(w))
            else:
                raise ConfigError('Unexpected agenda entry "{}" in {}'.format(k, self.filepath))
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/core/agenda.py/Agenda._load