def load_cli_plugins(cli): if os.environ.get("DEBUG_PLUGINS", "0").lower() in ("true", "1"): # importing localstack.config is still quite expensive... logging.basicConfig(level=logging.DEBUG) loader = PluginManager("localstack.plugins.cli", load_args=(cli, )) loader.load_all()
def __init__(self, config): super().__init__() self.config = config self.plugin_manager = PluginManager(self, os.path.join(self.config['home_path'], self.config['plugin_path'])) self.plugin_manager.load_plugins() self.builtin_commands = { 'quit': self._quit, 'join': self._join, 'part': self._part, 'loaded': self._plugin_loaded, 'unload': self._plugin_unload, 'load': self._plugin_load, 'reload': self._plugin_reload, 'ping': self._ping, 'help': self._command_help } self.events = { 'send_privmsg': self._send_privmsg_event, 'privmsg': self._privmsg_event, 'stop': self._stop_event, 'pong': self._pong_event, 'users': self._qnull_event, 'part': self._part_event, 'recv': self._qnull_event, 'send': self._qnull_event, 'server_ping': self._qnull_event, 'join': self._qnull_event } self.channels = {}
def __init__( self, plugin_manager: PluginManager[ServicePlugin] = None, provider_config: ServiceProviderConfig = None, ) -> None: super().__init__() self.plugin_errors = ServicePluginErrorCollector() self.plugin_manager = plugin_manager or PluginManager( PLUGIN_NAMESPACE, listener=self.plugin_errors) self._api_provider_specs = None self.provider_config = provider_config or config.SERVICE_PROVIDER_CONFIG
def __init__(self): ''' Gets references to important widgets, establishes event handlers, configures the tree view, and initializes the tree with the contents of the desktop. ''' # mark the root of this window with its PID so we can easily identify it # as this app root_atk = atk.get_root() root_atk.set_description(str(os.getpid())) self.node = Node() self.window = AccerciserMainWindow(self.node) self.window.connect('destroy', self._onQuit) # Start hotkey manager self.hotkey_manager = HotkeyManager() self.bookmarks_store = BookmarkStore(self.node) # load plugins self.plugin_manager = \ PluginManager(self.node, self.hotkey_manager, self.window.pluginview1, self.window.pluginview2) # connect signal handlers and show the GUI in its initial state self.window.show_all() main_actions = gtk.ActionGroup('MainActions') ui_manager.uimanager.insert_action_group(main_actions, 0) main_actions.add_actions([ ('Quit', gtk.STOCK_QUIT, None, '<control>q', 'Quit Accerciser', self._onQuit), ('Preferences', gtk.STOCK_PREFERENCES, _('_Preferences...'), '<control>p', 'Show preferences', self._onShowPreferences), ('Contents', gtk.STOCK_HELP, _('_Contents'), 'F1', 'View contents of manual', self._onHelp), ('About', gtk.STOCK_ABOUT, None, None, 'About Accerciser', self._onAbout) ]) for action_name, menu_path in [('Quit', ui_manager.FILE_MENU_PATH), ('Preferences', ui_manager.EDIT_MENU_PATH), ('Contents', ui_manager.HELP_MENU_PATH), ('About', ui_manager.HELP_MENU_PATH)]: action = main_actions.get_action(action_name) ui_manager.uimanager.add_ui(ui_manager.uimanager.new_merge_id(), menu_path, action_name, action_name, gtk.UIManagerItemType.MENUITEM, False) self.last_focused = None self.window.show_all()
def load(namespace, name): """ Attempts to load a plugin using a PluginManager. """ manager = PluginManager(namespace) with console.status(f"Loading {namespace}:{name}"): then = time.time() plugin = manager.load(name) took = time.time() - then rprint( f":tada: successfully loaded [bold][green]{namespace}[/green][/bold]:[bold][cyan]{name}[/cyan][/bold] ({type(plugin)}" ) rprint(f":stopwatch: loading took {took:.4f} s")
def cmd_list(namespace): """ List all available plugins using a PluginManager from available endpoints. """ manager = PluginManager(namespace) t = Table() t.add_column("Name") t.add_column("Factory") for spec in manager.list_plugin_specs(): ep = spec_to_entry_point(spec) t.add_row(spec.name, ep.value) rprint(t)
def __init__(self, config_file=None, underlay_default_conf=True): # The basics ShowBase.__init__(self) base.disableMouse() #builtins.plugin_manager = PluginManager() #plugin_manager.load_plugins() configs = [] if underlay_default_conf: framework_conf = os.path.dirname( os.path.abspath(__file__)) + "/core.cfg" configs.append(framework_conf) if config_file is not None: configs.append(config_file) self.plugin_manager = PluginManager(configs)
def __init__(self, name=None, **kwargs): if name: self.name = name else: self.name = type(self).name self.log = logging.getLogger(self.name) self.log.info('Initialize cli') self.unknown_args = None global_parser = self.global_parser() # pre-parse from global_parser as well as config file and use for commands self.pre_parser = argparse.ArgumentParser(add_help=False, parents=[global_parser]) # specifically parsing arguments from associated config file if any #self.options = argparse.Namespace() self.options, self.unknown = self.pre_parser.parse_known_args() self.setup_logger(self.options.logfile, self.options.verbose) # then set up the real parser, cloning the initial one self.parser = argparse.ArgumentParser( parents=[self.pre_parser], add_help=True, formatter_class=argparse.ArgumentDefaultsHelpFormatter) if self.unknown: if '-h' or '-?' in self.unknown: self.parser.print_help() sys.exit(1) self.log.warn('Not parsing unknown arguments: {!s}'.format( self.unknown)) # check for application configs and parse app_config = current_path.absolute().joinpath('{0}.conf'.format( self.name)) self.read_config(app_config) # check for user config parameter and parse if self.options.config: self.read_config(self.options.config) self.plugin_manager = PluginManager(self.options) self.setup_plugins() self.log.debug('Current Params: {!s}'.format(self.options)) self.log.info('Complete CLI initialization')
def __init__(self): self.repositories: PluginManager[InstallerRepository] = PluginManager( InstallerRepository.namespace)
def __init__(self): self.plugin_manager = PluginManager() self.plugin_manager.loadBasePlugins()
def __init__(self, account_id, private_key, provider, dev=False): self.plugin = PluginManager() self.plugin.load(PLUGINS_PATH) self.plugin.set_default_solverclass('gcs_solver.py') self.dev = dev self.account_id = account_id self.web3 = Web3(provider) self.interest = '' self.trusted_users = [] self.web3.eth.defaultAccount = account_id # PoA であれば geth_poa_middleware を利用 try: self.web3.eth.getBlock("latest") except ExtraDataLengthError: self.web3.middleware_onion.inject(geth_poa_middleware, layer=0) if private_key: self.web3.middleware_onion.add( construct_sign_and_send_raw_middleware(private_key)) self.deploy_erc1820() self.__observer = None self.__state = None self.assets = None # Wallet の情報 self.wallet = Wallet(self.web3, self.account_id) # オペレータ(トークンの交換などを担当)のコントラクト self.operator_address = None self.load_config() self.operator_address = self._fix_config_address( self.config['operator']['address']) if self.config['operator']['solver_pluginfile']: self.plugin.set_solverclass( self.operator_address, self.config['operator']['solver_pluginfile']) self.contracts = Contracts(self.web3) self.deploy_metemcyberutil() self.fetch_trusted_users() self.event_listener = BasicEventListener('') self.event_listener.start() # inventory (トークン・カタログの管理)のインスタンス生成 catalog_address = self._fix_config_address( self.config['catalog']['address']) broker_address = self._fix_config_address( self.config['broker']['address']) self.inventory = Inventory(self.contracts, self.account_id, self.event_listener, catalog_address, broker_address) # Seeker (チャレンジの依頼者)のインスタンス self.seeker = Seeker(self.contracts) # Solver (チャレンジの受領者)としてのインスタンス if self.operator_address: solverclass = self.plugin.get_solverclass(self.operator_address) self.solver = solverclass(self.contracts, self.account_id, self.operator_address) else: self.solver = None # MISP設定のinsert self.load_misp_config(MISP_INI_FILEPATH)