API Documentation¶
Let’s take a look at how ploogz works.
ploogz¶
Provide a brief description of the module.
ploogz.ploogins¶
Ploogins and Ploogin Loaders
-
class
ploogz.ploogins.
FsPlooginLoader
¶ Bases:
ploogz.ploogins.PlooginLoader
This is a ploogin loader that looks for ploogins in the local file system.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
load
(search_path: typing.List[str]) → typing.List[ploogz.ploogins.Ploogin]¶ Load the ploogins found in the search paths on the file system.
Parameters: search_path (List[str]) – the paths the loader will search when the load()
method is called
-
-
class
ploogz.ploogins.
Ploogin
(name: str)¶ Bases:
object
Extend this class to create your own ploogins!
-
__init__
(name: str)¶ Parameters: name ( str
) – a helpful, descriptive, human-readable name for the plugin
-
activate
¶ An input for a L{MethodicalMachine}.
-
active
= MethodicalState(method=<function Ploogin.active>)¶
-
initialized
= MethodicalState(method=<function Ploogin.initialized>)¶
-
name
¶ Get the helpful, descriptive, human-readable name for the ploogin.
Return type: str
-
ready
= MethodicalState(method=<function Ploogin.ready>)¶
-
setup
¶ An input for a L{MethodicalMachine}.
-
teardown
¶ An input for a L{MethodicalMachine}.
-
torndown
= MethodicalState(method=<function Ploogin.torndown>)¶
-
-
class
ploogz.ploogins.
PlooginEventHandler
(event: ploogz.ploogins.PlooginEvents, f: typing.Callable)¶ Bases:
object
Instances of this are callable and wrap handler functions for well-known event ploogin event types.
-
__init__
(event: ploogz.ploogins.PlooginEvents, f: typing.Callable)¶ Parameters: - event (
PlooginEvents
) – What type of event does this handler handle? - f (Callable) – the handler function
- event (
-
event
¶ What type of event does this handler handle?
-
-
class
ploogz.ploogins.
PlooginEvents
¶ Bases:
enum.Enum
These are the well known events that occur in the life cycle of a ploogin.
-
ACTIVATE
= ('activate',)¶
-
SETUP
= ('setup',)¶
-
TEARDOWN
= 'teardown'¶
-
-
class
ploogz.ploogins.
PlooginHost
(search_path: typing.List[str] = None, loader: ploogz.ploogins.PlooginLoader = None)¶ Bases:
object
Use a host object to load and retrieve your ploogins.
-
__init__
(search_path: typing.List[str] = None, loader: ploogz.ploogins.PlooginLoader = None)¶ Parameters: search_path (List[str] or str
) – the paths the plugin host will search when theload()
method is calledSeealso: PlooginHost.load()
Note
If no search path is provided, the default path is
builtin/ploogins
under the current working directory.
-
initialized
= MethodicalState(method=<function PlooginHost.initialized>)¶
-
load
¶ An input for a L{MethodicalMachine}.
-
loaded
= MethodicalState(method=<function PlooginHost.loaded>)¶
-
ploogins
¶ Get the ploogins loaded by this host.
Return type: Iterator[Ploogin]
-
teardown
¶ An input for a L{MethodicalMachine}.
-
torndown
= MethodicalState(method=<function PlooginHost.torndown>)¶
-
-
class
ploogz.ploogins.
PlooginLoader
¶ Bases:
object
Extend this class to create a ploogin loader that can look through search paths to find and instantiate ploogins.
-
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
load
(search_path: typing.List[str]) → typing.List[ploogz.ploogins.Ploogin]¶ Override this method to implement the loader’s primary loading logic.
Parameters: search_path (List[str]) – the paths the plugin host will search when the load()
method is called
-
-
ploogz.ploogins.
upon_activate
(f: typing.Callable)¶ Use this decorator to mark your ploogin function as a handler to call upon activation.
-
ploogz.ploogins.
upon_setup
(f: typing.Callable)¶ Use this decorator to mark your ploogin function as a handler to call upon setup.
-
ploogz.ploogins.
upon_teardown
(f: typing.Callable)¶ Use this decorator to mark you ploogin function as a handler to call upon teardown.