The pre_init function of the plugin. Here rafcon-classes can be extended/monkey-patched or completely substituted.
    A example is given with the rafcon_execution_hooks_plugin.
    :return:
348181
def pre_init():
    

    logger.info("Run pre-initiation hook of {} plugin.".format(__file__.split(os.path.sep)[-2]))

    # Example: Monkey-Path rafcon.core.script.Script class to print additional log-message while execution
    from rafcon.core.script import Script
    old_execute_method = Script.execute

    def new_execute_method(self, state, inputs=None, outputs=None, backward_execution=False):
        logger.debug("patched version of Script class is used.")
        result = old_execute_method(self, state, inputs, outputs, backward_execution)
        logger.debug("patched version of Script execute-method is finished with result: {}.".format(result))
        return result

    Script.execute = new_execute_method
1253492
def initialize_plugin(self):
        
        # Generate a list of blacklisted packages from the configuration and
        # store it into self.blacklist_package_names attribute so this
        # operation doesn't end up in the fastpath.
        if not self.blacklist_package_names:
            self.blacklist_release_requirements = (
                self._determine_filtered_package_requirements()
            )
            logger.info(
                f"Initialized release plugin {self.name}, filtering "
                + f"{self.blacklist_release_requirements}"
            )
1069023
def register_precmd_hook(self, func: Callable[[plugin.PrecommandData], plugin.PrecommandData]) -> None:
        """"""
        self._validate_prepostcmd_hook(func, plugin.PrecommandData)
        self._precmd_hooks.append(func)
314859
public static function initialize() {

		$instance = new static();

		/**
		 * Fires right before hook listeners are registered.
		 *
		 * @param HookListenersRegistry $registry
		 */
		do_action( self::ACTION_REGISTER, $instance );

		array_walk(
			$instance->listeners,
			function ( HookListenerInterface $listener ) use ( $instance ) {

				/**
				 * Filters whether to enable the hook listener.
				 *
				 * @param bool                  $enable
				 * @param HookListenerInterface $listener
				 */
				if ( apply_filters( self::FILTER_ENABLED, TRUE, $listener ) ) {
					$hooks = (array) $listener->listen_to();
					array_walk( $hooks, [ $instance, 'listen_hook' ], $listener );
				}
			}
		);

		unset( $instance->listeners );
		$instance->listeners = [];
	}
16598
def use_plugin_preset(self, preset):
        
        if isinstance(preset, str):
            try:
                preset = self._presets[preset]
            except (AttributeError, KeyError):
                raise AngrNoPluginError("There is no preset named %s" % preset)

        elif not isinstance(preset, PluginPreset):
            raise ValueError("Argument must be an instance of PluginPreset: %s" % preset)

        if self._active_preset:
            l.warning("Overriding active preset %s with %s", self._active_preset, preset)
            self.discard_plugin_preset()

        preset.activate(self)
        self._active_preset = preset
430234
function initPlugins() {
        var name,
            plugin,
            plugins = config.plugins || {};
        for (name in plugins) {
            plugin = scope.createComponent('plugin-' + name);
            if (plugin && util.isFn(plugin.init)) {
                plugin.init(config.plugins[name]);
            }
        }
    }
804111
def _init():
    
    # If there is a context and it is initialized to this request,
    # return, otherwise reinitialize the _local_context.
    if (hasattr(_local_context, '_initialized') and
            _local_context._initialized == os.environ.get('REQUEST_ID_HASH')):
        return

    # Used to track the context object stack.
    _local_context.registry = []

    # Used to provide easy access to the currently running Async job.
    _local_context._executing_async_context = None
    _local_context._executing_async = []

    # So that we do not inadvertently reinitialize the local context.
    _local_context._initialized = os.environ.get('REQUEST_ID_HASH')

    return _local_context
1039891
def init(self):
        
        # remove root logger, so we can reinit
        # TODO only remove our own
        # TODO move to _init, let overrides use init()
        logging.getLogger().handlers = []

        if self.debug:
            logging.basicConfig(level=logging.DEBUG, format=self.log_format_debug)
        elif self.verbose:
            logging.basicConfig(level=logging.INFO, format=self.log_format)
        elif not self.quiet:
            logging.basicConfig(level=logging.ERROR, format=self.log_format)
        else:
            logging.getLogger().addHandler(logging.NullHandler())
1294253
public function init()
    {
        parent::init();

        $this->regexp = new Regexp();

        $this->authScheme = HTTP_Request2::AUTH_BASIC;

        // Other dependencies that should only be loaded when class is actually used
        include_once 'HTTP/Request2/Observer/Log.php';
    }
594398
def _preloading_env(self):
        
        ctx = self.env.globals
        try:
            ctx['random_model'] = lambda *a, **kw: None
            ctx['random_models'] = lambda *a, **kw: None
            yield self.env
        finally:
            ctx['random_model'] = jinja2.contextfunction(random_model)
            ctx['random_models'] = jinja2.contextfunction(random_models)
15275
protected static function init() {
        global $CFG;

        // Init only once per request/CLI execution, we ignore changes done afterwards.
        if (isset(self::$plugintypes)) {
            return;
        }

        if (defined('IGNORE_COMPONENT_CACHE') and IGNORE_COMPONENT_CACHE) {
            self::fill_all_caches();
            return;
        }

        if (!empty($CFG->alternative_component_cache)) {
            // Hack for heavily clustered sites that want to manage component cache invalidation manually.
            $cachefile = $CFG->alternative_component_cache;

            if (file_exists($cachefile)) {
                if (CACHE_DISABLE_ALL) {
                    // Verify the cache state only on upgrade pages.
                    $content = self::get_cache_content();
                    if (sha1_file($cachefile) !== sha1($content)) {
                        die('Outdated component cache file defined in $CFG->alternative_component_cache, can not continue');
                    }
                    return;
                }
                $cache = array();
                include($cachefile);
                self::$plugintypes      = $cache['plugintypes'];
                self::$plugins          = $cache['plugins'];
                self::$subsystems       = $cache['subsystems'];
                self::$parents          = $cache['parents'];
                self::$subplugins       = $cache['subplugins'];
                self::$classmap         = $cache['classmap'];
                self::$classmaprenames  = $cache['classmaprenames'];
                self::$filemap          = $cache['filemap'];
                return;
            }

            if (!is_writable(dirname($cachefile))) {
                die('Can not create alternative component cache file defined in $CFG->alternative_component_cache, can not continue');
            }

            // Lets try to create the file, it might be in some writable directory or a local cache dir.

        } else {
            // Note: $CFG->cachedir MUST be shared by all servers in a cluster,
            //       use $CFG->alternative_component_cache if you do not like it.
            $cachefile = "$CFG->cachedir/core_component.php";
        }

        if (!CACHE_DISABLE_ALL and !self::is_developer()) {
            // 1/ Use the cache only outside of install and upgrade.
            // 2/ Let developers add/remove classes in developer mode.
            if (is_readable($cachefile)) {
                $cache = false;
                include($cachefile);
                if (!is_array($cache)) {
                    // Something is very wrong.
                } else if (!isset($cache['version'])) {
                    // Something is very wrong.
                } else if ((float) $cache['version'] !== (float) self::fetch_core_version()) {
                    // Outdated cache. We trigger an error log to track an eventual repetitive failure of float comparison.
                    error_log('Resetting core_component cache after core upgrade to version ' . self::fetch_core_version());
                } else if ($cache['plugintypes']['mod'] !== "$CFG->dirroot/mod") {
                    // $CFG->dirroot was changed.
                } else {
                    // The cache looks ok, let's use it.
                    self::$plugintypes      = $cache['plugintypes'];
                    self::$plugins          = $cache['plugins'];
                    self::$subsystems       = $cache['subsystems'];
                    self::$parents          = $cache['parents'];
                    self::$subplugins       = $cache['subplugins'];
                    self::$classmap         = $cache['classmap'];
                    self::$classmaprenames  = $cache['classmaprenames'];
                    self::$filemap          = $cache['filemap'];
                    return;
                }
                // Note: we do not verify $CFG->admin here intentionally,
                //       they must visit admin/index.php after any change.
            }
        }

        if (!isset(self::$plugintypes)) {
            // This needs to be atomic and self-fixing as much as possible.

            $content = self::get_cache_content();
            if (file_exists($cachefile)) {
                if (sha1_file($cachefile) === sha1($content)) {
                    return;
                }
                // Stale cache detected!
                unlink($cachefile);
            }

            // Permissions might not be setup properly in installers.
            $dirpermissions = !isset($CFG->directorypermissions) ? 02777 : $CFG->directorypermissions;
            $filepermissions = !isset($CFG->filepermissions) ? ($dirpermissions & 0666) : $CFG->filepermissions;

            clearstatcache();
            $cachedir = dirname($cachefile);
            if (!is_dir($cachedir)) {
                mkdir($cachedir, $dirpermissions, true);
            }

            if ($fp = @fopen($cachefile.'.tmp', 'xb')) {
                fwrite($fp, $content);
                fclose($fp);
                @rename($cachefile.'.tmp', $cachefile);
                @chmod($cachefile, $filepermissions);
            }
            @unlink($cachefile.'.tmp'); // Just in case anything fails (race condition).
            self::invalidate_opcode_php_cache($cachefile);
        }
    }
1219551
public static function init() {
		if ( is_null( self::$instance ) ) {
			self::$instance = new self();
			self::hooks( self::$instance );
		}
		return self::$instance;
	}
716889
def initialize_plugin(self):
        
        self.create_toggle_view_action()

        self.plugin_actions = self.get_plugin_actions() + [MENU_SEPARATOR,
                                                           self.undock_action]
        add_actions(self.options_menu, self.plugin_actions)
        self.options_button.setMenu(self.options_menu)
        self.options_menu.aboutToShow.connect(self.refresh_actions)

        self.sig_show_message.connect(self.show_message)
        self.sig_update_plugin_title.connect(self.update_plugin_title)
        self.sig_option_changed.connect(self.set_option)
        self.setWindowTitle(self.get_plugin_title())
685761
function initAppHandlers (cfg = {}) {
	_.each(handlers, (handler, name) => App[name] = _.partial(handler, _, (_.isFunction(cfg[name])) ? cfg[name] : _.noop));
}
943134
def initialize_plugin(self):
        
        # TODO: should retrieving the plugin's config be part of the base class?
        try:
            config = self.configuration["filter_regex"]["releases"]
        except KeyError:
            return
        else:
            if not self.patterns:
                pattern_strings = [pattern for pattern in config.split("\n") if pattern]
                self.patterns = [
                    re.compile(pattern_string) for pattern_string in pattern_strings
                ]

                logger.info(f"Initialized regex release plugin with {self.patterns}")
87471
def _setup(self):
        ""
        self.example.error = None
        self.example.traceback = ''
        # inject function contexts from parent functions
        c = Context(parent=self.context)
        #for parent in reversed(self.example.parents):
        #    c._update_properties(locals_from_function(parent))
        self.context = c
        if self.is_root_runner:
            run.before_all.execute(self.context)
        self.example.before(self.context)
1119716
def _init(self, *args, **kwargs):
        
        self._init_attr('_deps', None)

        self._init_attr('_ban_optimize', False)
        self._init_attr('_engine', None)
        self._init_attr('_Expr__execution', None)

        self._init_attr('_need_cache', False)
        self._init_attr('_mem_cache', False)

        if '_id' not in kwargs:
            kwargs['_id'] = new_id()

        super(Expr, self)._init(*args, **kwargs)