load actors from path and returns the modules once they're loaded
180648
function loadActors (fount, actors) {
  let result

  function addActor (acc, instance) {
    let factory = isFunction(instance.state)
      ? instance.state : () => clone(instance.state)
    processHandles(instance)
    acc[ instance.actor.type ] = {
      factory: factory,
      metadata: instance
    }
    return acc
  }

  function onActors (list) {
    function onInstances (instances) {
      return instances.reduce(addActor, {})
    }

    let modules = filter(list)
    let promises = modules.map((modulePath) => {
      let actorFn = loadModule(modulePath)
      return fount.inject(actorFn)
    })

    return Promise
      .all(promises)
      .then(onInstances)
  }

  if (isString(actors)) {
    let filePath = actors
    if (!fs.existsSync(filePath)) {
      filePath = path.resolve(process.cwd(), filePath)
    }
    return getActors(filePath)
      .then(onActors)
  } else if (Array.isArray(actors)) {
    result = actors.reduce((acc, instance) => {
      addActor(acc, instance)
      return acc
    }, {})
    return Promise.resolve(result)
  } else if (isObject(actors)) {
    let keys = Object.keys(actors)
    result = keys.reduce((acc, key) => {
      let instance = actors[ key ]
      addActor(acc, instance)
      return acc
    }, {})
    return Promise.resolve(result)
  } else if (isFunction(actors)) {
    result = actors()
    if (!result.then) {
      result = Promise.resolve(result)
    }
    return result.then(function (list) {
      return list.reduce((acc, instance) => {
        addActor(acc, instance)
        return Promise.resolve(acc)
      }, {})
    })
  }
}
1138691
def load_module(modulename, modulepath):
    
    if '.' in modulename:
        modulepackage, modulebase = modulename.rsplit('.', 1)
    else:
        modulepackage = ''

    imp.acquire_lock()
    try:
        # Check if module is already loaded
        if modulename not in sys.modules:
            # Find module on disk and try to load it
            path, name = os.path.split(modulepath)
            name = os.path.splitext(name)[0]
            handle, path, info = imp.find_module(name, [path])
            try:
                # Load the module and put into sys.modules
                module = imp.load_module(modulename, handle, path, info)
                if modulepackage:
                    setattr(sys.modules[modulepackage], modulebase, module)
            finally:
                # Make sure handle is closed properly
                if handle:
                    handle.close()
    finally:
        imp.release_lock()

    return sys.modules[modulename]
986124
function loadResources( state, filePath ) {
	var resourcePath = path.resolve( process.cwd(), filePath );
	return getResources( resourcePath )
		.then( function( list ) {
			return when.all( _.map( _.filter( list ), loadModule.bind( undefined, state ) ) )
				.then( function( lists ) {
					return _.flatten( lists );
				} );
		} );
}
63793
def load_module(path):
    '''
        
    '''
    with add_to_path(os.path.dirname(path)):
        spec    = importlib.util.spec_from_file_location(os.path.basename(path).replace('.py',''), path)
        module  = importlib.util.module_from_spec(spec)
        spec.loader.exec_module(module)
    return module
725713
def load(path):
    """"""
    with open(path) as rfile:
        steps = MODEL.parse(rfile.read())

    new_steps = []
    for step in steps:
        new_steps += expand_includes(step, path)

    return new_steps
72319
function (options, iterationInfo, modules) {
        // filename filter
        if (options.fileNameFilter) {
            var match = iterationInfo.fileName.match(options.fileNameFilter);
            if (!match) {
                return;
            }
        }

        // Filter spec.js files
        var match = iterationInfo.fileName.match(/.spec.js/i);
        if (match) {
            return;
        }

        // relative path filter
        if (options.relativePathFilter) {
            var pathMatch = iterationInfo.relativeFullPath.match(options.relativePathFilter);
            if (!pathMatch)
                return;
        }

        //load module
        loadModule(modules, options, iterationInfo);
    }
80280
def load(self, paths):
        
        for path in paths:
            self.models.append(Model(path))
989509
def load_dynamic(self, matches):
        '''
        
        '''
        if not self.opts['autoload_dynamic_modules']:
            return
        syncd = self.state.functions['saltutil.sync_all'](list(matches),
                                                          refresh=False)
        if syncd['grains']:
            self.opts['grains'] = salt.loader.grains(self.opts)
            self.state.opts['pillar'] = self.state._gather_pillar()
        self.state.module_refresh()
1078102
function loadModules($searchPaths, $maxdepth) {

		$modules = [];

		// Final all modules
		// =================

		$idx = 0; // module order index

		$knownSegments = [];

		foreach ($searchPaths as $path) {
			$loadpath = $this->syspath.'/'.$path;
			$files = $this->find_file('composer.json', $loadpath, $maxdepth);
			foreach ($files as $file) {
				$composerjson = \json_decode($this->file_get_contents($file->getRealPath()), true);
				if ($this->composer_has_cfsinfo($composerjson)) {
					$moduleName = $composerjson['name'];

					// backwards compatibility
					$moduleName = \str_replace('.', '/', $moduleName);

					$this->state['modules'][$moduleName] = [
						'idx' => null,
						'enabled' => true,
						'path' => realpath($file->getPath()),
						'namespace' => \str_replace('/', '\\', $moduleName).'\\',
						'rules' => [
							'identity' => [],
							'matches-before' => []
						]
					];

					$slashPos = \strpos($moduleName, '/');

					if ($slashPos === false || $slashPos == 0) {
						throw new \Exception('Invalid freia module name ['.$moduleName.']. The module name must have at least two segments seperated by a slash');
					}

					$mainsegment = \substr($moduleName, 0, $slashPos);

					if ( ! \in_array($mainsegment, $knownSegments)) {
						$knownSegments[] = $mainsegment;
					}

					// create entry in ordering index for rules reference
					$modules[$moduleName] = $idx += 1;

					if (isset($composerjson['extra'], $composerjson['extra']['freia'], $composerjson['extra']['freia']['rules'])) {
						$this->state['modules'][$moduleName]['rules'] = array_merge($this->state['modules'][$moduleName]['rules'], $composerjson['extra']['freia']['rules']);
						if ( ! $this->debugMode) {
							if (in_array('debug', $this->state['modules'][$moduleName]['rules']['identity'])) {
								$this->state['modules'][$moduleName]['enabled'] = false;
							}
						}
					}
				}
			}
		}

		$this->state['known-segments'] = $knownSegments;

		// Apply Stacking Rules
		// ====================

		$iteration = 0;

		do {

			// Sanity Check
			// ------------

			# it's entirely poissible for recursive rules to be applied, so we
			# need to have a stop mechanism; the system will try to function
			# even if recursion is detected; but a warning will be shown

			$iteration += 1;
			if ($iteration == $this->maxRulesIterations()) {
				$this->error_log("Exceeded maximum rule iteration count; potentially recursive module ruleset");
				throw new \Exception("Exceeded maximum iterations count while trying to apply module rules; potential module recursive rules");
			}

			// Sorter
			// ------

			$ordered = true;
			$ordered_modules = $modules;

			foreach ($this->state['modules'] as $moduleName => $module) {
				foreach ($module['rules']['matches-before'] as $target) {

					# matches-before: this module recieves idx of top
					# matching target -1 and all other modules aside from
					# this module who have idx < target idx recieve -1,
					# all entries with idx > old module idx recieve -1; if
					# target is not found in the modules or if the idx is
					# already smaller then the entire operation is skipped
					# and everyting retains their current idx

					$targetmodulename = static::firstMatchingModule(\array_keys($ordered_modules), $target);

					if ($targetmodulename !== null) {
						$target_idx = $ordered_modules[$targetmodulename];
						if ($target_idx < $ordered_modules[$module]) {

							$updated_modules = $ordered_modules;
							$old_module_idx = $updated_modules[$module];
							$updated_modules[$module] = $updated_modules[$targetmodulename] - 1;

							foreach ($ordered_modules as $k => $idx) {
								if ($idx < $target_idx && $k != $module) {
									$updated_modules[$k] = $idx - 1;
								}
								else if ($idx > $old_module_idx) {
									$updated_modules[$k] = $idx - 1;
								}
							}

							asort($updated_modules);
							$ordered_modules = $updated_modules;
							$ordered = false;
						}
					}
				}
			}

			$modules = $ordered_modules;
		}
		while ( ! $ordered);

		// Integrate Updated Order
		// =======================

		$updatedModules = [];
		foreach ($modules as $moduleName => $idx) {
			$updatedModules[$moduleName] = $this->state['modules'][$moduleName];
			$updatedModules[$moduleName]['idx'] = $idx;
		}

		$this->state['modules'] = $updatedModules;
	}
235752
def load(cls, fpath):
        
        module_name = os.path.splitext(os.path.basename(fpath))[0]

        sys.path.insert(0, os.path.dirname(fpath))
        try:
            module = import_module(module_name)

        finally:
            sys.path = sys.path[1:]

        return module
53688
def _load_module(self, module_path):
        """"""
        # __import__ will fail on unicode,
        # so we ensure module path is a string here.
        module_path = str(module_path)

        try:
            module_name, attr_name = module_path.split(':', 1)
        except ValueError:  # noqa
            raise self.error(
                '"{}" is not of format "module:parser"'.format(module_path))

        try:
            mod = __import__(module_name, globals(), locals(), [attr_name])
        except (Exception, SystemExit) as exc:  # noqa
            err_msg = 'Failed to import "{}" from "{}". '.format(
                attr_name, module_name)
            if isinstance(exc, SystemExit):
                err_msg += 'The module appeared to call sys.exit()'
            else:
                err_msg += 'The following exception was raised:\n{}'.format(
                    traceback.format_exc())

            raise self.error(err_msg)

        if not hasattr(mod, attr_name):
            raise self.error('Module "{}" has no attribute "{}"'.format(
                module_name, attr_name))

        parser = getattr(mod, attr_name)

        if not isinstance(parser, click.BaseCommand):
            raise self.error('"{}" of type "{}" is not derived from '
                             '"click.BaseCommand"'.format(
                                 type(parser), module_path))
        return parser
392091
def load_models(module):
    """"""
    modules = _import_submodules(module)
    return {m for module in modules for m in filter(
        _check_model, (getattr(module, name) for name in dir(module))
    )}
627215
def load_modules(self, data=None, proxy=None):
        '''
        
        '''
        log.info('Loading fresh modules for state activity')
        # Load a modified client interface that looks like the interface used
        # from the minion, but uses remote execution
        #
        self.functions = salt.client.FunctionWrapper(
                self.opts,
                self.opts['id']
                )
        # Load the states, but they should not be used in this class apart
        # from inspection
        self.utils = salt.loader.utils(self.opts)
        self.serializers = salt.loader.serializers(self.opts)
        self.states = salt.loader.states(self.opts, self.functions, self.utils, self.serializers)
        self.rend = salt.loader.render(self.opts, self.functions, states=self.states, context=self.state_con)
710409
def load_modules(self, args):
        """"""

        # Init the plugins dict
        # Active plugins dictionnary
        self._plugins = collections.defaultdict(dict)
        # Load the plugins
        self.load_plugins(args=args)

        # Init the export modules dict
        # Active exporters dictionnary
        self._exports = collections.defaultdict(dict)
        # All available exporters dictionnary
        self._exports_all = collections.defaultdict(dict)
        # Load the export modules
        self.load_exports(args=args)

        # Restoring system path
        sys.path = sys_path
1227859
def from_module(self, path):
        """"""
        bundles = PythonLoader(path).load_bundles()
        for name in bundles:
            self.register(name, bundles[name])
13896
def load_modules(self, modules, config):
        """"""
        for pluginclass in get_plugin_classes(modules):
            name = pluginclass.__name__
            if name in config["enabledplugins"]:
                if issubclass(pluginclass, _ConnectionPlugin):
                    log.debug(LOG_PLUGIN, "Enable connection plugin %s", name)
                    self.connection_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ContentPlugin):
                    log.debug(LOG_PLUGIN, "Enable content plugin %s", name)
                    self.content_plugins.append(pluginclass(config[name]))
                elif issubclass(pluginclass, _ParserPlugin):
                    log.debug(LOG_PLUGIN, "Enable parser plugin %s", name)
                    self.parser_plugins.append(pluginclass(config[name]))
                else:
                    raise ValueError("Invalid plugin class %s" % pluginclass)
780585
def load_shutit_modules(self):
		
		shutit_global.shutit_global_object.yield_to_draw()
		if self.loglevel <= logging.DEBUG:
			self.log('ShutIt module paths now: ',level=logging.DEBUG)
			self.log(self.host['shutit_module_path'],level=logging.DEBUG)
		for shutit_module_path in self.host['shutit_module_path']:
			self.load_all_from_path(shutit_module_path)