Skip to content

TYP: use type annotations in vectorized.pyi #41774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions pandas/_libs/tslibs/vectorized.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
For cython types that cannot be represented precisely, closest-available
python equivalents are used, and the precise types kept as adjacent comments.
"""
from __future__ import annotations

from datetime import tzinfo
from typing import (
Optional,
Union,
)

import numpy as np

Expand All @@ -16,32 +14,24 @@ from pandas._libs.tslibs.offsets import BaseOffset
def dt64arr_to_periodarr(
stamps: np.ndarray, # const int64_t[:]
freq: int,
tz: Optional[tzinfo],
tz: tzinfo | None,
) -> np.ndarray: ... # np.ndarray[np.int64, ndim=1]


def is_date_array_normalized(
stamps: np.ndarray, # const int64_t[:]
tz: Optional[tzinfo] = None,
tz: tzinfo | None = None,
) -> bool: ...


def normalize_i8_timestamps(
stamps: np.ndarray, # const int64_t[:]
tz: Optional[tzinfo],
tz: tzinfo | None,
) -> np.ndarray: ... # np.ndarray[np.int64]


def get_resolution(
stamps: np.ndarray, # const int64_t[:]
tz: Optional[tzinfo] = None,
tz: tzinfo | None = None,
) -> Resolution: ...


def ints_to_pydatetime(
arr: np.ndarray, # const int64_t[:}]
tz: Optional[tzinfo] = None,
freq: Optional[Union[str, BaseOffset]] = None,
tz: tzinfo | None = None,
freq: str | BaseOffset | None = None,
fold: bool = False,
box: str = "datetime",
) -> np.ndarray: ... # np.ndarray[object]