You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shepherd-agent/tests/classtestplugin.py

48 lines
1.0 KiB

from configspec import *
from shepherd import PluginInterface, plugin_class, plugin_function, plugin_hook, plugin_attachment
interface = PluginInterface()
confspec = ConfigSpecification()
confspec.add_spec("spec1", StringSpec(helptext="helping!"))
@plugin_function
def module_function(a: str):
return "module func return"
@plugin_class
class ClassPlugin():
def __init__(self):
self.config = interface.config
self.interface = interface
self.plugins = interface.plugins
# self.hooks = interface.hooks
@plugin_function
def instance_method(self, a: str):
return "instance method return"
@plugin_function
@classmethod
def class_method(cls, a: str):
return "class method return"
@plugin_function
@staticmethod
def static_method(a: str):
return "static method return"
# @plugin_hook
# def callback(self):
# pass
# @plugin_attachment("pluginname.hookname")
# def caller(self):
# pass
# interface.register_plugin(SystemPlugin)