aboutsummaryrefslogtreecommitdiffstats
path: root/qface/utils.py
blob: d784bff2396c44ceadba51b25659e55afcbe9bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from .generator import FileSystem
from .helper import doc
import click

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():
        return {}

    click.secho('loading extra filters from {}'.format(path), fg='green')
    ctx = {
        'filters': {}
    }
    exec(path.text(), ctx)
    return ctx['filters']