arelle.plugin_system._plugin_manager

See COPYRIGHT.md for copyright information.

Module Contents

Classes

Data

API

arelle.plugin_system._plugin_manager.PLUGIN_TRACE_FILE: str | None

None

arelle.plugin_system._plugin_manager.PLUGIN_TRACE_LEVEL

None

arelle.plugin_system._plugin_manager.EMPTYLIST: list[Any]

[]

class arelle.plugin_system._plugin_manager.PluginManager

Initialization

property isInitialized: bool
init(cntlr: arelle.Cntlr.Cntlr, loadPluginConfig: bool = True) None
reset() None
orderedPluginConfig() dict[str, Any]
save(cntlr: arelle.Cntlr.Cntlr) None
close() None
logPluginTrace(message: str, level: int) None

If plugin trace file logging is configured, logs message to it. Only logs to controller logger if log is an error.

Parameters:
  • message – Message to be logged

  • level – Log level of message (e.g. logging.INFO)

modulesWithNewerFileDates() set[str]
freshenModuleInfos() None
static normalizeModuleFilename(moduleFilename: str) str | None

Attempts to find python script as plugin entry point. A value will be returned if moduleFilename exists as-is, if moduleFilename is a directory containing init.py, or if moduleFilename with .py extension added exists

Parameters:

moduleFilename

Returns:

Normalized filename, if exists

getModuleFilename(moduleURL: str, reload: bool, normalize: bool, base: str | None) tuple[str | None, importlib.metadata.EntryPoint | None]
parsePluginInfo(moduleURL: str, moduleFilename: str, entryPoint: importlib.metadata.EntryPoint | None) dict[str, Any] | None
moduleModuleInfo(moduleURL: str | None = None, entryPoint: importlib.metadata.EntryPoint | None = None, reload: bool = False, parentImportsSubtree: bool = False) dict[str, Any] | None

Generates a module info dict based on the provided moduleURL or entryPoint Exactly one of “moduleURL” or “entryPoint” must be provided, otherwise a RuntimeError will be thrown.

When moduleURL is provided, it will be treated as a file path and will attempt to be normalized and mapped to an existing plugin based on file location. If moduleURL fails to be mapped to an existing plugin on its own, it will instead be used to search for an entry point. If found, this function will proceed as if that entry point was provided for entryPoint.

When entryPoint is provided, it’s location and other details will be used to generate the module info dictionary.

Parameters:
  • moduleURL – A URL that loosely maps to the file location of a plugin (may be transformed)

  • entryPoint – An EntryPoint instance

  • reload

  • parentImportsSubtree

Returns:

s

static moduleInfo(pluginInfo: Any) None

This is an empty function in place for backwards compatability. Will be removed in future release.

loadModule(moduleInfo: dict[str, Any], packagePrefix: str = '') None
hasPluginWithHook(name: str) bool
pluginClassMethods(className: str) collections.abc.Iterator[collections.abc.Callable[..., Any]]
addPluginModule(name: str) dict[str, Any] | None

Discover plugin entry points with given name.

Parameters:

name – The name to search for

Returns:

The module information dictionary, if added. Otherwise, None.

reloadPluginModule(name: str) bool
removePluginModule(name: str) bool
addPluginModuleInfo(plugin_module_info: dict[str, Any] | None) dict[str, Any] | None

Given a dictionary containing module information, loads plugin info into pluginConfig

Parameters:

plugin_module_info – Dictionary of module info fields. See comment block in PluginManager.py for structure.

Returns:

The module information dictionary, if added. Otherwise, None.