Loads all plugins specified in the RAFCON_PLUGIN_PATH environment variable
964503
def load_plugins():
    
    plugins = os.environ.get('RAFCON_PLUGIN_PATH', '')
    plugin_list = set(plugins.split(os.pathsep))
    global plugin_dict
    for plugin_path in plugin_list:
        if not plugin_path:
            continue
        plugin_path = os.path.expandvars(os.path.expanduser(plugin_path)).strip()
        if not os.path.exists(plugin_path):
            logger.error("The specified plugin path does not exist: {}".format(plugin_path))
            continue
        dir_name, plugin_name = os.path.split(plugin_path.rstrip('/'))
        logger.info("Found plugin '{}' at {}".format(plugin_name, plugin_path))
        sys.path.insert(0, dir_name)
        if plugin_name in plugin_dict:
            logger.error("Plugin '{}' already loaded".format(plugin_name))
        else:
            try:
                module = importlib.import_module(plugin_name)
                plugin_dict[plugin_name] = module
                logger.info("Successfully loaded plugin '{}'".format(plugin_name))
            except ImportError as e:
                logger.error("Could not import plugin '{}': {}\n{}".format(plugin_name, e, str(traceback.format_exc())))
503814
def _load_plugins(self):
        
        plugins = ait.config.get('server.plugins')

        if plugins is None:
            log.warn('No plugins specified in config.')
        else:
            for index, p in enumerate(plugins):
                try:
                    plugin = self._create_plugin(p['plugin'])
                    self.plugins.append(plugin)
                    log.info('Added plugin {}'.format(plugin))

                except Exception:
                    exc_type, value, tb = sys.exc_info()
                    log.error('{} creating plugin {}: {}'.format(exc_type,
                                                                 index,
                                                                 value))
            if not self.plugins:
                log.warn('No valid plugin configurations found. No plugins will be added.')
278857
def plugins(all, plugins_dir):
    ""
    app = Datasette([], plugins_dir=plugins_dir)
    click.echo(json.dumps(app.plugins(all), indent=4))
120397
def _load_plugin(self, plugin_script, args=None, config=None):
        """"""
        # The key is the plugin name
        # for example, the file glances_xxx.py
        # generate self._plugins_list["xxx"] = ...
        name = plugin_script[len(self.header):-3].lower()
        try:
            # Import the plugin
            plugin = __import__(plugin_script[:-3])
            # Init and add the plugin to the dictionary
            if name in ('help', 'amps', 'ports', 'folders'):
                self._plugins[name] = plugin.Plugin(args=args, config=config)
            else:
                self._plugins[name] = plugin.Plugin(args=args)
            # Set the disable_<name> to False by default
            if self.args is not None:
                setattr(self.args,
                        'disable_' + name,
                        getattr(self.args, 'disable_' + name, False))
        except Exception as e:
            # If a plugin can not be log, display a critical message
            # on the console but do not crash
            logger.critical("Error while initializing the {} plugin ({})".format(name, e))
            logger.error(traceback.format_exc())
770089
def load_manifests(self):
        
        for path in self.plugin_paths:
            for item in os.listdir(path):
                item_path = os.path.join(path, item)
                if os.path.isdir(item_path):
                    self.load_manifest(item_path)
594536
def load_plugin():
    """"""

    # Add EV3 configuration window
    workbench=get_workbench()
    workbench.set_default("ev3.ip", "192.168.0.1")
    workbench.set_default("ev3.username", "robot")
    workbench.set_default("ev3.password", "maker")
    workbench.add_configuration_page("EV3", Ev3ConfigurationPage)


    # icons

    image_path_remoterun = os.path.join(os.path.dirname(__file__), "res", "remoterun.gif")
    image_path_remotedebug = os.path.join(os.path.dirname(__file__), "res", "remotedebug.gif")


    image_path_upload = os.path.join(os.path.dirname(__file__), "res", "up.gif")
    image_path_run = os.path.join(os.path.dirname(__file__), "res", "flash.gif")
    image_path_log = os.path.join(os.path.dirname(__file__), "res", "log.gif")

    image_path_clean = os.path.join(os.path.dirname(__file__), "res", "clean.gif")





    # menu buttons

    get_workbench().add_command("ev3remoterun", "run", "Run current script using the EV3 API in remote control mode" ,
                                get_button_handler_for_magiccmd_on_current_file("Ev3RemoteRun"),
                                currentscript_and_command_enabled,
                                default_sequence="<F9>",
                                group=20,
                                image_filename=image_path_remoterun,
                                include_in_toolbar=True)
    get_workbench().add_command("ev3remotedebug", "run", "Debug current script using the EV3 API in remote control mode" ,
                                get_button_handler_for_magiccmd_on_current_file("Ev3RemoteDebug"),
                                currentscript_and_command_enabled,
                                default_sequence="<Control-F9>",
                                group=20,
                                image_filename=image_path_remotedebug,
                                include_in_toolbar=True)

    get_workbench().add_command("ev3patch", "tools", "Install ev3dev additions to the ev3dev sdcard on the EV3",
                                patch_ev3,
                                command_enabled,
                                default_sequence=None,
                                group=270,
                                #image_filename=image_path_upload,
                                include_in_toolbar=False)

    get_workbench().add_command("ev3softreset", "tools", "Soft reset the EV3  (stop programs,rpyc started sound/motors,restart brickman and rpycd service)",
                                soft_reset_ev3,
                                command_enabled,
                                default_sequence=None,
                                group=275,
                                #image_filename=image_path_clean,
                                include_in_toolbar=False)



    get_workbench().add_command("ev3upload", "tools", "Upload current script to EV3",
                                upload_current_script,
                                currentscript_and_command_enabled,
                                default_sequence="<F10>",
                                group=280,
                                image_filename=image_path_upload,
                                include_in_toolbar=True)
    get_workbench().add_command("ev3run", "tools", "Start current script on the EV3",
                                start_current_script,
                                currentscript_and_command_enabled,
                                default_sequence="<Control-F10>",
                                group=280,
                                image_filename=image_path_run,
                                include_in_toolbar=True)
    get_workbench().add_command("ev3log", "tools", "Download log of current script from EV3",
                                download_log_of_current_script,
                                currentscript_and_command_enabled,
                                default_sequence=None,
                                group=280,
                                image_filename=image_path_log,
                                include_in_toolbar=True)

    get_workbench().add_command("ev3clean", "tools", "Cleanup EV3 by deleting all files stored in homedir on EV3",
                                cleanup_files_on_ev3,
                                command_enabled,
                                default_sequence=None,
                                group=290,
                                image_filename=image_path_clean,
                                include_in_toolbar=True)



    orig_interrupt_backend=get_runner().interrupt_backend
    def wrapped_interrupt_backend():

        # kill program on pc
        orig_interrupt_backend()

        # stop programmings running on ev3 and stop sound/motors via rpyc
        stop_ev3_programs__and__rpyc_motors_sound()


    get_runner().interrupt_backend = wrapped_interrupt_backend



    # magic commands
    shell = get_workbench().get_view("ShellView")

    shell.add_command("Ev3RemoteRun", _handle_rundebug_from_shell)
    shell.add_command("Ev3RemoteDebug", _handle_rundebug_from_shell)


    shell.add_command("Reset", _handle_reset_from_shell)

    shell.add_command("pwd", _handle_pwd_from_shell)
    shell.add_command("cd", _handle_cd_from_shell)
    shell.add_command("ls", _handle_ls_from_shell)
    shell.add_command("help", _handle_help_from_shell)
    shell.add_command("open", _handle_open_from_shell)
    shell.add_command("reload", _handle_reload_from_shell)
639879
def _load_plugins(self):
        '''
        
        '''
        plugins = self.settings['PLUGINS']

        self.plugins_dict = {}
        for key in plugins:
            # skip loading the plugin if its value is None
            if plugins[key] is None:
                continue
            # valid plugin, import and setup
            self.logger.debug("Trying to load plugin {cls}".format(cls=key))
            the_class = self._import_class(key)
            instance = the_class()
            instance._set_logger(self.logger)
            if not self.unit_test:
                instance.setup(self.settings)
            the_schema = None
            with open(self.settings['PLUGIN_DIR'] + instance.schema) as the_file:
                the_schema = json.load(the_file)

            mini = {}
            mini['instance'] = instance
            mini['schema'] = the_schema
            self.logger.debug("Successfully loaded plugin {cls}".format(cls=key))
            self.plugins_dict[plugins[key]] = mini

        self.plugins_dict = OrderedDict(sorted(list(self.plugins_dict.items()),
                                               key=lambda t: t[0]))
71881
private void loadPlugins() {
		// Read the plugin class names from well known resources
		try {
			Enumeration<URL> pluginResources = classLoader.get().getResources(
					"META-INF/services/org.springsource.reloading.agent.Plugins");
			while (pluginResources.hasMoreElements()) {
				URL pluginResource = pluginResources.nextElement();
				if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINEST)) {
					log.finest("loadPlugins: TypeRegistry=" + this.toString() + ": loading plugin list file "
							+ pluginResource);
				}
				InputStream is = pluginResource.openStream();
				BufferedReader pluginClassNamesReader = new BufferedReader(new InputStreamReader(is));
				try {
					while (true) {
						String pluginName = pluginClassNamesReader.readLine();
						if (pluginName == null) {
							break;
						}
						if (!pluginName.startsWith("#")) {
							pluginClassNames.add(pluginName);
						}
					}
				}
				catch (IOException ioe) {
					// eof
				}
				is.close();
			}
		}
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		// Now load those plugins
		for (String pluginClassName : pluginClassNames) {
			if (GlobalConfiguration.isRuntimeLogging && log.isLoggable(Level.FINEST)) {
				log.finest("loadPlugins: TypeRegistry=" + this.toString() + ": loading plugin " + pluginClassName);
			}
			try {
				Class<?> pluginClass = Class.forName(pluginClassName, false, this.classLoader.get());
				Plugin pluginInstance = (Plugin) pluginClass.newInstance();
				localPlugins.add(pluginInstance);
			}
			catch (Exception e) {
				log.log(Level.WARNING, "Unable to find and instantiate plugin " + pluginClassName, e);
			}
		}
	}
145308
def load_plugins(self):
        
        try:
            from pkg_resources import iter_entry_points
        except ImportError:
            return
        for ep in iter_entry_points(group="custodian.%s" % self.plugin_type):
            f = ep.load()
            f()
527502
def _load_mod_ui_libraries(self, path):
        
        path = path / Path('mod')
        sys.path.append(str(path))
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
924470
def add_plugin_load_paths
      configuration.add_plugin_paths(extension_loader.paths(:plugin))
      super
      ActiveSupport::Dependencies.autoload_once_paths -= extension_loader.paths(:load)
    end
795258
def find_plugins():
     
    plugin_dir = os.path.dirname(os.path.realpath(__file__))
    plugin_dir = os.path.join(plugin_dir, "plugins")
    plugin_files = [x[:-3] for x in os.listdir(plugin_dir) if x.endswith(".py")]
    sys.path.insert(0, plugin_dir)
    for plugin in plugin_files:
        __import__(plugin)
1053918
def _load_plugins(config, cfgparser):
    
    # set umask before any plugin gets a chance to create a file
    os.umask(config['umask'])

    for s in cfgparser.sections():
        if s in {'ENV', 'global'}:
            # ENV section is only used for interpolation
            continue

        if s.startswith('/'):
            menu = 'consumers'
            path_chain = s.split('/')
            if path_chain[-1] == '':
                path_chain = path_chain[:-1]
            name = tuple(path_chain)
        else:
            if s.startswith('auth:'):
                menu = 'authenticators'
                name = s[5:]
            elif s.startswith('authz:'):
                menu = 'authorizers'
                name = s[6:]
            elif s.startswith('store:'):
                menu = 'stores'
                name = s[6:]
            else:
                raise ValueError('Invalid section name [%s].\n' % s)

        try:
            config[menu][name] = _create_plugin(cfgparser, s, menu)
        except Exception as e:
            logger.debug("Plugin '%s' failed to load.", name, exc_info=True)
            raise RuntimeError(menu, name, e)

    # 2nd initialization stage
    for menu in ['authenticators', 'authorizers', 'consumers', 'stores']:
        plugins = config[menu]
        for name in sorted(plugins):
            plugin = plugins[name]
            plugin.finalize_init(config, cfgparser, context=None)
1352575
def load_plugin(filename, plugin_globals, plugin_locals):
        

        plugin = open(filename, 'rU')

        try:
            exec(plugin.read(), plugin_globals, plugin_locals)
        except ImportError:
            return False
        except Exception as e:
            raise WidgetPluginError("%s: %s" % (e.__class__, str(e)))
        finally:
            plugin.close()

        return True
1081372
def load_plugins_dir(path, category=None, overwrite=False):
    
    # get potential plugin python files
    if hasattr(path, 'glob'):
        pypaths = path.glob('*.py')
    else:
        pypaths = glob.glob(os.path.join(path, '*.py'))

    load_errors = []
    for pypath in pypaths:
        # use uuid to ensure no conflicts in name space
        mod_name = str(uuid.uuid4())
        try:
            if hasattr(pypath, 'resolve'):
                # Make the path absolute, resolving any symlinks
                pypath = pypath.resolve()

            with warnings.catch_warnings(record=True):
                warnings.filterwarnings("ignore", category=ImportWarning)

                # for MockPaths
                if hasattr(pypath, 'maketemp'):
                    with pypath.maketemp() as f:
                        module = load_source(mod_name, f.name)
                else:
                    module = load_source(mod_name, str(pypath))

        except Exception as err:
            load_errors.append((str(pypath), 'Load Error: {}'.format(err)))
            continue

        # only get classes that are local to the module
        class_members = inspect.getmembers(module, inspect.isclass)
        classes = [klass for klass_name, klass in class_members if
                   klass.__module__ == mod_name]
        load_errors += load_plugin_classes(classes, category, overwrite)

    return load_errors
954090
def load_plugins(classprefix, plugin_list):
    
    # classprefix "cmd3.plugins."
    plugins = []
    import_object = {}
    # log.info(str(list))
    for plugin in plugin_list:
        if cygwin:
            plugin = path_into_cygpath(plugin)
        # print ("PPPPP", classprefix, plugin)

        try:
            import_object[plugin] = __import__(
                classprefix + "." + plugin, globals(), locals(), [plugin], -1)
            # print ("TTT", import_object[plugin], type(import_object[plugin]))
            load_module = "cls = import_object['{0}'].{1}".format(plugin, plugin)
            # print ("LLL", load_module)
            exec(load_module)
            plugins.append(cls)
        except Exception, e:
            # if echo:
            Console.error("loading module {0} {1}".format(str(plugin), str(classprefix)))
            Console.error(70 * "=")
            print(e)
            Console.error(70 * "=")
            print(traceback.format_exc())
            Console.error(70 * "-")
            print(sys.exc_info()[0])
            Console.error(70 * "-")
            
    return plugins