4 Commits
4 changed files with 25 additions and 5 deletions
+5 -1
View File
@@ -16,6 +16,10 @@ if __name__ == "__main__":
""" """
system = XtendRSystem() system = XtendRSystem()
system.attach("example_plugin") # Assuming 'example_plugin/plugin_info.json' exists system.attach("example_plugin") # Assuming 'example_plugin/plugin_info.json' exists
system.run("example_plugin") system.run("example_plugin", test="Hello!")
system.stop("example_plugin")
system.run("example_plugin", 25)
system.stop("example_plugin")
system.run("example_plugin", "Hello!", 25)
system.stop("example_plugin") system.stop("example_plugin")
system.detach("example_plugin") system.detach("example_plugin")
+18 -2
View File
@@ -5,12 +5,28 @@ class ExamplePlugin(XtendRBase):
Example: Example:
>>> plugin = ExamplePlugin() >>> plugin = ExamplePlugin()
>>> plugin.run() >>> plugin.run("Hello!", 25)
Passed arguments 2:
Argument 0: Hello!
Argument 1: 25
ExamplePlugin is running! ExamplePlugin is running!
>>> plugin.stop() >>> plugin.stop()
ExamplePlugin has stopped! ExamplePlugin has stopped!
""" """
def run(self): def run(self, *args, **kwargs):
arglen = len(args)
keylen = len(kwargs)
if arglen > 0:
print(f"Passed arguments {arglen}:")
for idx, a in enumerate(args):
print(f"Argument {idx}: {a}")
if keylen > 0:
print(f"Keyword arguments passed {keylen}")
if not "test" in kwargs:
raise ValueError("Didn't get expected 'test' keyword!")
for kw in kwargs:
print(f"Argument {kw}: {kwargs[kw]}")
print("ExamplePlugin is running!") print("ExamplePlugin is running!")
def stop(self): def stop(self):
+1 -1
View File
@@ -3,7 +3,7 @@ if __name__ == "__main__":
setup( setup(
name="XtendR", name="XtendR",
version="0.1.3", version="0.2.1",
packages=find_packages(), packages=find_packages(),
install_requires=[], install_requires=[],
author="Jan Lerking", author="Jan Lerking",
+1 -1
View File
@@ -17,7 +17,7 @@ class XtendRBase(ABC):
Stopping TestPlugin Stopping TestPlugin
""" """
@abstractmethod @abstractmethod
def run(self): def run(self, *args, **kwargs):
pass pass
@abstractmethod @abstractmethod