def _concat_rangeindex_same_dtype(indexes):
from pandas import Int64Index, RangeIndex<EOL>start = step = next = None<EOL>non_empty_indexes = [obj for obj in indexes if len(obj)]<EOL>for obj in non_empty_indexes:<EOL><INDENT>if start is None:<EOL><INDENT>start = obj._start<EOL>if step is None and len(obj) > <NUM_LIT:1>:<EOL><INDENT>step = obj._step<EOL><DEDENT><DEDENT>elif step is None:<EOL><INDENT>if obj._start == start:<EOL><INDENT>return _concat_index_same_dtype(indexes, klass=Int64Index)<EOL><DEDENT>step = obj._start - start<EOL><DEDENT>non_consecutive = ((step != obj._step and len(obj) > <NUM_LIT:1>) or<EOL>(next is not None and obj._start != next))<EOL>if non_consecutive:<EOL><INDENT>return _concat_index_same_dtype(indexes, klass=Int64Index)<EOL><DEDENT>if step is not None:<EOL><INDENT>next = obj[-<NUM_LIT:1>] + step<EOL><DEDENT><DEDENT>if non_empty_indexes:<EOL><INDENT>stop = non_empty_indexes[-<NUM_LIT:1>]._stop if next is None else next<EOL>return RangeIndex(start, stop, step)<EOL><DEDENT>return RangeIndex(<NUM_LIT:0>, <NUM_LIT:0>)<EOL>
Concatenates multiple RangeIndex instances. All members of "indexes" must
be of type RangeIndex; result will be RangeIndex if possible, Int64Index
otherwise. E.g.:
indexes = [RangeIndex(3), RangeIndex(3, 6)] -> RangeIndex(6)
indexes = [RangeIndex(3), RangeIndex(4, 6)] -> Int64Index([0,1,2,4,5])