Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit ec32a00

Browse files
authored
TYP: annotate two decorators (pandas-dev#47184)
1 parent 96acb6a commit ec32a00

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pandas/core/computation/align.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)
1010
from typing import (
1111
TYPE_CHECKING,
12+
Callable,
1213
Sequence,
1314
)
1415
import warnings
@@ -28,6 +29,8 @@
2829
from pandas.core.computation.common import result_type_many
2930

3031
if TYPE_CHECKING:
32+
from pandas._typing import F
33+
3134
from pandas.core.generic import NDFrame
3235
from pandas.core.indexes.api import Index
3336

@@ -62,7 +65,7 @@ def _any_pandas_objects(terms) -> bool:
6265
return any(isinstance(term.value, PandasObject) for term in terms)
6366

6467

65-
def _filter_special_cases(f):
68+
def _filter_special_cases(f) -> Callable[[F], F]:
6669
@wraps(f)
6770
def wrapper(terms):
6871
# single unary operand

pandas/core/reshape/merge.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ def _groupby_and_merge(by, left: DataFrame, right: DataFrame, merge_pieces):
162162
lcols = lhs.columns.tolist()
163163
cols = lcols + [r for r in right.columns if r not in set(lcols)]
164164
merged = lhs.reindex(columns=cols)
165-
merged.index = range(len(merged))
165+
# error: Incompatible types in assignment (expression has type
166+
# "range", variable has type "Index")
167+
merged.index = range(len(merged)) # type: ignore[assignment]
166168
pieces.append(merged)
167169
continue
168170

pandas/util/_decorators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def wrapper(*args, **kwargs):
323323

324324
def rewrite_axis_style_signature(
325325
name: str, extra_params: list[tuple[str, Any]]
326-
) -> Callable[..., Any]:
326+
) -> Callable[[F], F]:
327327
def decorate(func: F) -> F:
328328
@wraps(func)
329329
def wrapper(*args, **kwargs) -> Callable[..., Any]:

0 commit comments

Comments
 (0)