Пример #1
0
def get_template_v(alist, unit, id, key):
    ret = None
    children = _.result(_.find(alist, {'unit':unit}), 'children')
    if children:
        p0 = _.result(_.find(children, {'id':id}), key)
        if p0:
            ret = p0
    return ret
Пример #2
0
def check_has_subunit(alist, line_name, unit):
    ret = []
    children = _.result(_.find(alist, {'unit':unit}), 'children')
    ids = _.pluck(children, 'id')
    ids = _.map(ids, lambda x:'unitsub_' + x)
    for id in ids:
        p = get_occur_p(line_name, id)
        if p>0:
            ret.append(id)
    return ret