(nodes, position)
return nodes_before.count(','), key_str
Returns the amount of commas and the keyword argument string.
Returns the amount of commas and the keyword argument string.
Returns the amount of commas and the keyword argument string .
def _get_index_and_key(nodes, position):
    """
    Returns the amount of commas and the keyword argument string.
    """
    nodes_before = [c for c in nodes if c.start_pos < position]
    if nodes_before[-1].type == 'arglist':
        nodes_before = [c for c in nodes_before[-1].children if c.start_pos < position]

    key_str = None

    if nodes_before:
        last = nodes_before[-1]
        if last.type == 'argument' and last.children[1].end_pos <= position:
            # Checked if the argument
            key_str = last.children[0].value
        elif last == '=':
            key_str = nodes_before[-2].value

    return nodes_before.count(','), key_str
def _get_index_and_key ( nodes , position ) : nodes_before = [ c for c in nodes if c . start_pos < position ] if nodes_before [ - 1 ] . type == 'arglist' : nodes_before = [ c for c in nodes_before [ - 1 ] . children if c . start_pos < position ] key_str = None if nodes_before : last = nodes_before [ - 1 ] if last . type == 'argument' and last . children [ 1 ] . end_pos <= position : # Checked if the argument key_str = last . children [ 0 ] . value elif last == '=' : key_str = nodes_before [ - 2 ] . value return nodes_before . count ( ',' ) , key_str