-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprogram.py
More file actions
23 lines (19 loc) · 726 Bytes
/
program.py
File metadata and controls
23 lines (19 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#/usr/bin/python
# -*- coding: UTF-8 -*-
import mount_point
import spf
__author__ = 'Régis Décamps'
#load plugins in the ``plugins``directory
all_plugins = spf.load_plugins()
class MyProgram:
# descriptor can be be invoked automatically only upon attribute access.
text_plugins = spf.ExtensionsAt(mount_point.TextTransformer)
def main(self):
# Here I declare a mount point TextTransformer
# "hello world" will be printed by each plugin
for plugin in self.text_plugins:
retval = plugin.transform_text("hello world")
print("Plugin {plugin} produces {retval}".format(plugin=plugin, retval=retval))
if __name__ == '__main__':
prog = MyProgram()
prog.main()