aboutsummaryrefslogtreecommitdiffstats
path: root/qface/utils.py
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-12-24 13:32:17 +0100
committerJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-12-24 13:32:17 +0100
commitca2868a450c4090d5460827a896648280bb72eb0 (patch)
treee2bcb28bb3d8f3d3efc86bb1c064380cd5579e60 /qface/utils.py
parent0a3ae7686e1100be452b8c435bdcd84ec242340e (diff)
parent7091420944250d11b2f5e9a1783a14e74480e8bc (diff)
Merge branch 'release/2.0'2.0
Diffstat (limited to 'qface/utils.py')
-rw-r--r--qface/utils.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/qface/utils.py b/qface/utils.py
index 3122d38..889d862 100644
--- a/qface/utils.py
+++ b/qface/utils.py
@@ -1,10 +1,24 @@
+from .generator import FileSystem
+from .helper import doc
-def merge(a, b):
- "merges b into a recursively if a and b are dicts"
- for key in b:
- if isinstance(a.get(key), dict) and isinstance(b.get(key), dict):
- merge(a[key], b[key])
- else:
- a[key] = b[key]
- return a
+def module_info(text):
+ system = FileSystem.parse_text(text)
+ module = list(system.modules)[0]
+ return {
+ 'title': module.name,
+ 'brief': " ".join(doc.parse_doc(module.comment).brief)
+ }
+
+
+def load_filters(path):
+ if not path.exists():
+ print('filter module does not exist')
+ return {}
+
+ ctx = {
+ 'filters': {}
+ }
+ exec(path.text(), ctx)
+ return ctx['filters']
+