Skip to content

Commit 9a3176d

Browse files
committed
1 parent 99deb99 commit 9a3176d

5 files changed

Lines changed: 19 additions & 19 deletions

File tree

pandas-stubs/_libs/tslibs/offsets.pyi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ from typing_extensions import override
1919

2020
from pandas._libs.tslibs.timestamps import Timestamp
2121
from pandas._typing import (
22+
Frequency,
2223
ShapeT,
2324
np_ndarray_object,
2425
)
@@ -108,6 +109,11 @@ class BaseOffset:
108109

109110
class SingleConstructorOffset(BaseOffset): ...
110111

112+
@overload
113+
def to_offset(freq: None, is_period: bool = False) -> None: ...
114+
@overload
115+
def to_offset(freq: Frequency | timedelta, is_period: bool = False) -> BaseOffset: ...
116+
111117
class Tick(SingleConstructorOffset):
112118
def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
113119
@property
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
from datetime import timedelta
2-
from typing import overload
1+
from pandas.core.indexes.datetimes import DatetimeIndex
2+
from pandas.core.indexes.timedeltas import TimedeltaIndex
3+
from pandas.core.series import Series
34

4-
from pandas import (
5-
DatetimeIndex,
6-
Series,
7-
TimedeltaIndex,
8-
)
5+
from pandas._libs.tslibs.offsets import to_offset as to_offset
96

10-
from pandas._typing import Frequency
11-
12-
from pandas.tseries.offsets import BaseOffset
13-
14-
@overload
15-
def to_offset(freq: None, is_period: bool = False) -> None: ...
16-
@overload
17-
def to_offset(freq: Frequency | timedelta, is_period: bool = False) -> BaseOffset: ...
187
def infer_freq(index: Series | DatetimeIndex | TimedeltaIndex) -> str | None: ...

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,11 @@ python-version = "3.11"
344344
explicit-any = false # We do use implicit Any
345345
implicit-any-type-argument = false # We do use implicit Any
346346
untyped-import = false # Import discovery
347+
unused-call-result = false # results of check(...) are never used
347348
# TODO: remove when facebook/pyrefly#4427 is resolved
348349
unused-ignore = false
350+
# TODO: remove when facebook/pyrefly#4439 is resolved
351+
missing-source = false
349352

350353
[tool.ty.environment]
351354
python-platform = "all"

tests/frame/test_frame.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pyrefly: ignore-errors[implicit-any-lambda]
21
from __future__ import annotations
32

43
from collections import (
@@ -309,7 +308,10 @@ def test_assign() -> None:
309308
df = pd.DataFrame({"a": [1, 2, 3], 1: [4, 5, 6]})
310309

311310
my_unnamed_func = ( # pyright: ignore[reportUnknownVariableType]
312-
lambda df: df["a"] * 2 # pyright: ignore[reportUnknownLambdaType]
311+
lambda df: df[ # pyright: ignore[reportUnknownLambdaType] # pyrefly: ignore[implicit-any-lambda]
312+
"a"
313+
]
314+
* 2
313315
)
314316

315317
def my_named_func_1(df: pd.DataFrame) -> pd.Series[str]:

tests/test_typing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def _to_type(t: Any) -> type:
4242
if isinstance(t, ExtensionDtype):
4343
return type(t)
4444
if issubclass(type(t), np.dtype):
45-
return t.type # type: ignore[no-any-return]
46-
return t # type: ignore[no-any-return]
45+
return t.type # type: ignore[no-any-return] # pyrefly: ignore[no-any-return-explicit]
46+
return t # type: ignore[no-any-return] # pyrefly: ignore[no-any-return-explicit]
4747

4848

4949
@pytest.mark.parametrize(("dtype_arg", "alias_map"), DTYPE_ARG_ALIAS_MAPS.items())

0 commit comments

Comments
 (0)