(
cls,
start,
end,
periods: int | None,
freq,
tz=None,
normalize: bool = False,
ambiguous: TimeAmbiguous = "raise",
nonexistent: TimeNonexistent = "raise",
inclusive: IntervalClosedType = "both",
*,
unit: TimeUnit = "ns",
)
| 412 | |
| 413 | @classmethod |
| 414 | def _generate_range( |
| 415 | cls, |
| 416 | start, |
| 417 | end, |
| 418 | periods: int | None, |
| 419 | freq, |
| 420 | tz=None, |
| 421 | normalize: bool = False, |
| 422 | ambiguous: TimeAmbiguous = "raise", |
| 423 | nonexistent: TimeNonexistent = "raise", |
| 424 | inclusive: IntervalClosedType = "both", |
| 425 | *, |
| 426 | unit: TimeUnit = "ns", |
| 427 | ) -> Self: |
| 428 | periods = dtl.validate_periods(periods) |
| 429 | if freq is None and any(x is None for x in [periods, start, end]): |
| 430 | raise ValueError("Must provide freq argument if no data is supplied") |
| 431 | |
| 432 | if com.count_not_none(start, end, periods, freq) != 3: |
| 433 | raise ValueError( |
| 434 | "Of the four parameters: start, end, periods, " |
| 435 | "and freq, exactly three must be specified" |
| 436 | ) |
| 437 | freq = to_offset(freq) |
| 438 | |
| 439 | if start is not None: |
| 440 | start = Timestamp(start) |
| 441 | |
| 442 | if end is not None: |
| 443 | end = Timestamp(end) |
| 444 | |
| 445 | if start is NaT or end is NaT: |
| 446 | raise ValueError("Neither `start` nor `end` can be NaT") |
| 447 | |
| 448 | if unit is not None: |
| 449 | if unit not in ["s", "ms", "us", "ns"]: |
| 450 | raise ValueError("'unit' must be one of 's', 'ms', 'us', 'ns'") |
| 451 | else: |
| 452 | unit = "ns" |
| 453 | |
| 454 | if start is not None: |
| 455 | start = start.as_unit(unit, round_ok=False) |
| 456 | if end is not None: |
| 457 | end = end.as_unit(unit, round_ok=False) |
| 458 | |
| 459 | left_inclusive, right_inclusive = validate_inclusive(inclusive) |
| 460 | start, end = _maybe_normalize_endpoints(start, end, normalize) |
| 461 | tz = _infer_tz_from_endpoints(start, end, tz) |
| 462 | |
| 463 | if tz is not None: |
| 464 | # Localize the start and end arguments |
| 465 | start = _maybe_localize_point(start, freq, tz, ambiguous, nonexistent) |
| 466 | end = _maybe_localize_point(end, freq, tz, ambiguous, nonexistent) |
| 467 | |
| 468 | if freq is not None: |
| 469 | # Offset handling: |
| 470 | # Ticks (fixed-duration like hours/minutes): keep tz; do absolute-time math. |
| 471 | # Other calendar offsets: drop tz; do naive wall time; localize once later |
nothing calls this directly
no test coverage detected