MCPcopy Index your code
hub / github.com/HelloZeroNet/ZeroNet / __init__

Method __init__

src/Plugin/PluginManager.py:17–40  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

15
16class PluginManager:
17 def __init__(self):
18 self.log = logging.getLogger("PluginManager")
19 self.path_plugins = os.path.abspath(os.path.dirname(plugins.__file__))
20 self.path_installed_plugins = config.data_dir + "/__plugins__"
21 self.plugins = defaultdict(list) # Registered plugins (key: class name, value: list of plugins for class)
22 self.subclass_order = {} # Record the load order of the plugins, to keep it after reload
23 self.pluggable = {}
24 self.plugin_names = [] # Loaded plugin names
25 self.plugins_updated = {} # List of updated plugins since restart
26 self.plugins_rev = {} # Installed plugins revision numbers
27 self.after_load = [] # Execute functions after loaded plugins
28 self.function_flags = {} # Flag function for permissions
29 self.reloading = False
30 self.config_path = config.data_dir + "/plugins.json"
31 self.loadConfig()
32
33 self.config.setdefault("builtin", {})
34
35 sys.path.append(os.path.join(os.getcwd(), self.path_plugins))
36 self.migratePlugins()
37
38 if config.debug: # Auto reload Plugins on file change
39 from Debug import DebugReloader
40 DebugReloader.watcher.addCallback(self.reloadPlugins)
41
42 def loadConfig(self):
43 if os.path.isfile(self.config_path):

Callers

nothing calls this directly

Calls 3

loadConfigMethod · 0.95
migratePluginsMethod · 0.95
addCallbackMethod · 0.80

Tested by

no test coverage detected