Пример #1
0
def python_signature_complete(prefix, line, end, ctx, filter_func):
    """Completes a python function (or other callable) call by completing
    argument and keyword argument names.
    """
    front = line[:end]
    if xt.is_balanced(front, '(', ')'):
        return set()
    funcname = xt.subexpr_before_unbalanced(front, '(', ')')
    val, _ctx = _safe_eval(funcname, ctx)
    if val is None:
        return set()
    try:
        sig = inspect.signature(val)
    except ValueError:
        return set()
    args = {p + '=' for p in sig.parameters if filter_func(p, prefix)}
    return args
Пример #2
0
def python_signature_complete(prefix, line, end, ctx, filter_func):
    """Completes a python function (or other callable) call by completing
    argument and keyword argument names.
    """
    front = line[:end]
    if xt.is_balanced(front, '(', ')'):
        return set()
    funcname = xt.subexpr_before_unbalanced(front, '(', ')')
    val, _ctx = _safe_eval(funcname, ctx)
    if val is None and _ctx is None:
        return set()
    try:
        sig = inspect.signature(val)
    except ValueError:
        return set()
    args = {p + '=' for p in sig.parameters if filter_func(p, prefix)}
    return args
Пример #3
0
def test_is_not_balanced_parens(inp):
    obs = is_balanced(inp, "(", ")")
    assert not obs
Пример #4
0
def test_is_not_balanced_parens(inp):
    obs = is_balanced(inp, '(', ')')
    assert not obs
Пример #5
0
def test_is_not_balanced_parens(inp):
    obs = is_balanced(inp, "(", ")")
    assert not obs
Пример #6
0
def test_is_not_balanced_parens(inp):
    obs = is_balanced(inp, '(', ')')
    assert not obs