def _load_raw_from_source(self, source):
        if hasattr(source, 'read') and hasattr(source, 'name'):  # file-like object
            self.filepath = source.name
            raw = load_struct_from_yaml(text=source.read())
        elif isinstance(source, basestring):
            if os.path.isfile(source):
                self.filepath = source
                raw = load_struct_from_yaml(filepath=self.filepath)
            else:  # assume YAML text
                raw = load_struct_from_yaml(text=source)
        else:
            raise ConfigError('Unknown agenda source: {}'.format(source))
        return raw
dataset/ETHPy150Open ARM-software/workload-automation/wlauto/core/agenda.py/Agenda._load_raw_from_source/original