def find_first_arg_pos(bracket_offset, curr_line, options=None):
    """ find_first_arg_pos(bracket_offset : int, curr_line : str) -> [int, int]

    Arguments:
    bracket_offset - The position of the bracket in the current line e.g
        "    (  list 'timey 'wimey  )" --> 4
        " (  list 'timey 'wimey  )"    --> 1
        "(  list 'timey 'wimey  )"     --> 0

    >>> find_first_arg_pos(0, "(     list 'one-sheep 'two-sheep )")
    [11, 5]

    Returns the position of the first argument to the function relative to the
    position of the opening bracket and the number of spaces between the opening
    bracket and the function name.
    The two values will to be used to align the other arguments in the subsequent line
    """
    opts = parse_options(options)
    spaces_before_func = 0
    subline = curr_line[bracket_offset + 1:]
    if re.search('^[ \t]*($|\r)', subline):
        # whitespace extending to the end of the line means there's no
        # function in this line. The indentation level defaults to one.
        arg_pos = 1
    else:
        if bracket_offset != len(curr_line) - 1 and curr_line[bracket_offset + 1] == ' ':
            # control reaches here if we are not at the end of the line
            # and whitespace follows. We must first find the position of the
            # function and then the arguments position
            match = re.search(' +[^)\]]| \)', subline)  # Find the first non whitespace/bracket character
            if match:
                spaces_before_func = match.end() - match.start() - 1
                end = match.end()
            else:
                end = 0
            # Then use the end of the whitespace group as the first argument
            arg_pos = re.search(' +([^)])|( *(\(|\[))', subline[end:])
            if arg_pos:
                arg_pos = arg_pos.end() + spaces_before_func + 1
            else:
                arg_pos = spaces_before_func + 1
            if re.match('^[ \t]*(#\||;|$|\r)',
                        subline[(end - 1 + subline[end - 1:].find(' ')):]):
                # But, if a comment if found after the function name, the
                # indent level becomes one
                arg_pos = spaces_before_func + opts.default_indent
        else:
            # If there's no space after the bracket, simply find the end of the
            # whitespace group
            match = re.search(' +([^)}\n\r])|( *(\(|\[|{))', subline)
            if match:  # found the argument
                arg_pos = match.end()
            else:  # Either empty list or argument is in the next line
                arg_pos = 1
            if re.match('^[\t ]*(;|$|\r)', subline[subline.find(' '):]):
                # Again if a comment is found after the function name, the
                # indent level defaults to 1
                arg_pos = spaces_before_func + opts.default_indent
    return [arg_pos, spaces_before_func]
def find_first_arg_pos ( bracket_offset , curr_line , options = None ) : opts = parse_options ( options ) spaces_before_func = 0 subline = curr_line [ bracket_offset + 1 : ] if re . search ( '^[ \t]*($|\r)' , subline ) : arg_pos = 1 else : if bracket_offset != len ( curr_line ) - 1 and curr_line [ bracket_offset + 1 ] == ' ' : match = re . search ( ' +[^)\]]| \)' , subline ) if match : spaces_before_func = match . end ( ) - match . start ( ) - 1 end = match . end ( ) else : end = 0 arg_pos = re . search ( ' +([^)])|( *(\(|\[))' , subline [ end : ] ) if arg_pos : arg_pos = arg_pos . end ( ) + spaces_before_func + 1 else : arg_pos = spaces_before_func + 1 if re . match ( '^[ \t]*(#\||;|$|\r)' , subline [ ( end - 1 + subline [ end - 1 : ] . find ( ' ' ) ) : ] ) : arg_pos = spaces_before_func + opts . default_indent else : match = re . search ( ' +([^)}\n\r])|( *(\(|\[|{))' , subline ) if match : arg_pos = match . end ( ) else : arg_pos = 1 if re . match ( '^[\t ]*(;|$|\r)' , subline [ subline . find ( ' ' ) : ] ) : arg_pos = spaces_before_func + opts . default_indent return [ arg_pos , spaces_before_func ]
find_first_arg_pos(bracket_offset : int, curr_line : str) -> [int, int]

    Arguments:
    bracket_offset - The position of the bracket in the current line e.g
        "    (  list 'timey 'wimey  )" --> 4
        " (  list 'timey 'wimey  )"    --> 1
        "(  list 'timey 'wimey  )"     --> 0

    >>> find_first_arg_pos(0, "(     list 'one-sheep 'two-sheep )")
    [11, 5]

    Returns the position of the first argument to the function relative to the
    position of the opening bracket and the number of spaces between the opening
    bracket and the function name.
    The two values will to be used to align the other arguments in the subsequent line