From 1c4b950e0c40a6260ba3da7276227d82440e53a4 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Tue, 1 Jun 2021 19:00:58 -0500 Subject: [PATCH] TYP: use type annotations in vectorized.pyi --- pandas/_libs/tslibs/vectorized.pyi | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/pandas/_libs/tslibs/vectorized.pyi b/pandas/_libs/tslibs/vectorized.pyi index 6ed1e10ef2353..e3d5acdfe2577 100644 --- a/pandas/_libs/tslibs/vectorized.pyi +++ b/pandas/_libs/tslibs/vectorized.pyi @@ -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 @@ -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]