def generate_regular_range(start, end, periods, freq):
if isinstance(freq, Tick):<EOL><INDENT>stride = freq.nanos<EOL>if periods is None:<EOL><INDENT>b = Timestamp(start).value<EOL>e = (b + (Timestamp(end).value - b) // stride * stride +<EOL>stride // <NUM_LIT:2> + <NUM_LIT:1>)<EOL>tz = start.tz<EOL><DEDENT>elif start is not None:<EOL><INDENT>b = Timestamp(start).value<EOL>e = _generate_range_overflow_safe(b, periods, stride, side='<STR_LIT:start>')<EOL>tz = start.tz<EOL><DEDENT>elif end is not None:<EOL><INDENT>e = Timestamp(end).value + stride<EOL>b = _generate_range_overflow_safe(e, periods, stride, side='<STR_LIT:end>')<EOL>tz = end.tz<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>with np.errstate(over="<STR_LIT>"):<EOL><INDENT>try:<EOL><INDENT>values = np.arange(b, e, stride, dtype=np.int64)<EOL><DEDENT>except FloatingPointError:<EOL><INDENT>xdr = [b]<EOL>while xdr[-<NUM_LIT:1>] != e:<EOL><INDENT>xdr.append(xdr[-<NUM_LIT:1>] + stride)<EOL><DEDENT>values = np.array(xdr[:-<NUM_LIT:1>], dtype=np.int64)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>tz = None<EOL>if start is not None:<EOL><INDENT>tz = start.tz<EOL><DEDENT>elif end is not None:<EOL><INDENT>tz = end.tz<EOL><DEDENT>xdr = generate_range(start=start, end=end,<EOL>periods=periods, offset=freq)<EOL>values = np.array([x.value for x in xdr], dtype=np.int64)<EOL><DEDENT>return values, tz<EOL>
Generate a range of dates with the spans between dates described by
the given `freq` DateOffset.

Parameters
----------
start : Timestamp or None
    first point of produced date range
end : Timestamp or None
    last point of produced date range
periods : int
    number of periods in produced date range
freq : DateOffset
    describes space between dates in produced date range

Returns
-------
ndarray[np.int64] representing nanosecond unix timestamps