Ejemplo n.º 1
0
def func_view(path, func_name):
    session = Session()
    query = (session.query(Call, Function).join(Function).filter_by(
        file=path, name=func_name).order_by(Call.start_time.desc())[:200])
    if query:
        func = query[0][1]
        calls = [p[0] for p in query]
    else:
        func = session.query(Function).filter_by(file=path, name=func_name)[0]
        calls = None

    return render_template('function.html', func=func, calls=calls)
Ejemplo n.º 2
0
    return 'test_id_%s' % call_id


eye._call_id = call_id_mock


def get_call_ids(func):
    start_id = call_id + 1
    func()
    end_id = call_id + 1
    return ['test_id_%s' % i for i in range(start_id, end_id)]


# Do this here to make call ids consistent
golden_calls = [
    session.query(Call).filter_by(id=c_id).one()
    for c_id in get_call_ids(golden_script.main)
]

CallStuff = namedtuple('CallStuff', 'call, soup, call_data, func_data')


def get_call_stuff(c_id):
    call = session.query(Call).filter_by(id=c_id).one()

    # <pre> makes it preserve whitespace
    soup = BeautifulSoup('<pre>' + call.function.html_body + '</pre>',
                         'html.parser')

    call_data = normalise_call_data(call.data)
    func_data = json.loads(call.function.data)
Ejemplo n.º 3
0
    call_id += 1
    return 'test_id_%s' % call_id


eye._call_id = call_id_mock


def get_call_ids(func):
    start_id = call_id + 1
    func()
    end_id = call_id + 1
    return ['test_id_%s' % i for i in range(start_id, end_id)]


# Do this here to make call ids consistent
golden_calls = [session.query(Call).filter_by(id=c_id).one()
                for c_id in get_call_ids(golden_script.main)]

CallStuff = namedtuple('CallStuff', 'call, soup, call_data, func_data')


def get_call_stuff(c_id):
    call = session.query(Call).filter_by(id=c_id).one()

    # <pre> makes it preserve whitespace
    soup = BeautifulSoup('<pre>' + call.function.html_body + '</pre>', 'html.parser')

    call_data = normalise_call_data(call.data)
    func_data = json.loads(call.function.data)
    return CallStuff(call, soup, call_data, func_data)