Exemplo n.º 1
0
def infer_expr_stmt(context, stmt, seek_name=None):
    with recursion.execution_allowed(context.inference_state, stmt) as allowed:
        if allowed:
            if seek_name is not None:
                pep0484_values = \
                    annotation.find_type_from_comment_hint_assign(context, stmt, seek_name)
                if pep0484_values:
                    return pep0484_values

            return _infer_expr_stmt(context, stmt, seek_name)
    return NO_VALUES
def _remove_statements(context, stmt, name):
    """
    This is the part where statements are being stripped.

    Due to lazy type inference, statements like a = func; b = a; b() have to be
    inferred.

    TODO merge with infer_expr_stmt?
    """
    pep0484_values = \
        annotation.find_type_from_comment_hint_assign(context, stmt, name)
    if pep0484_values:
        return pep0484_values

    return infer_expr_stmt(context, stmt, seek_name=name)