def length_of_indexer(indexer, target=None):
if target is not None and isinstance(indexer, slice):<EOL><INDENT>target_len = len(target)<EOL>start = indexer.start<EOL>stop = indexer.stop<EOL>step = indexer.step<EOL>if start is None:<EOL><INDENT>start = <NUM_LIT:0><EOL><DEDENT>elif start < <NUM_LIT:0>:<EOL><INDENT>start += target_len<EOL><DEDENT>if stop is None or stop > target_len:<EOL><INDENT>stop = target_len<EOL><DEDENT>elif stop < <NUM_LIT:0>:<EOL><INDENT>stop += target_len<EOL><DEDENT>if step is None:<EOL><INDENT>step = <NUM_LIT:1><EOL><DEDENT>elif step < <NUM_LIT:0>:<EOL><INDENT>step = -step<EOL><DEDENT>return (stop - start + step - <NUM_LIT:1>) // step<EOL><DEDENT>elif isinstance(indexer, (ABCSeries, Index, np.ndarray, list)):<EOL><INDENT>return len(indexer)<EOL><DEDENT>elif not is_list_like_indexer(indexer):<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>raise AssertionError("<STR_LIT>")<EOL>
return the length of a single non-tuple indexer which could be a slice