Plugins¶
Plugins(conf) |
Manager for all plugins |
manager.Plugin(plugin, app) |
A single plugin object |
manager.PluginManager(name, loader) |
The base class for the plugin manager |
manager.DriverManager(app, name, loader) |
A plugin manager for a single plugin |
tools.PluginInfo |
Get info about a plugin |
tools.Weather |
Get the weather from the weather driver |
api.info |
Get the info of all the enabled plugins |
Plugins¶
Manager¶
-
class
blueweather.plugins.manager.Plugin(plugin: object, app: django.apps.config.AppConfig)¶ Bases:
objectA single plugin object
Contains information about the plugin
Parameters: - plugin – plugin object
- app – app the plugin belongs to
-
call(func: str, *args, **kwargs)¶ Call a function in the plugin
Parameters: func – function name to call
-
class
blueweather.plugins.manager.PluginManager(name: str, loader: callable)¶ Bases:
collections.abc.Sized,collections.abc.IterableThe base class for the plugin manager
-
load()¶ Load the plugins
-
map(func: callable)¶ Map a function to all the plugins this manager manages
Parameters: func – function to call on each plugin
-
mapCall(func_name, *args, **kwargs)¶ Map a function to all the plugins this manager manages
Parameters: func_name – name of the function to call
-
-
class
blueweather.plugins.manager.DriverManager(app: str, name: str, loader: callable)¶ Bases:
blueweather.plugins.manager.PluginManagerA plugin manager for a single plugin
Parameters: - app – app to load the plugin from
- loader – loader
-
load()¶ Load the plugins
Tools¶
The DAO is the link between BlueWeather and the plugins.
-
class
blueweather.plugins.tools.PluginInfo¶ Bases:
objectGet info about a plugin
-
classmethod
get_metadata(app: django.apps.config.AppConfig) → dict¶ Get the metadata for a plugin
Parameters: app – the app the plugin belongs to Returns: metadata for the plugin interface Metadata { packageName: string version?: string summary?: string homepage?: string author?: string email?: string license?: string description?: html }
-
classmethod
Utils¶
-
blueweather.plugins.utils.load_app_module(app: django.apps.config.AppConfig, module: str)¶ Load a module that belongs to an app
Parameters: - app – app to import from
- module – module name
Returns: found module or None
-
blueweather.plugins.utils.find_members(module) → List[Tuple[str, object]]¶ Find all the members of a module
Parameters: module – module Returns: all public members of the module
-
blueweather.plugins.utils.get_app(name: str) → django.apps.config.AppConfig¶ Get an app from its name
Parameters: name – app name Returns: AppConfig