Skip to content

Commit d2dd4c1

Browse files
Merge branch 'main' into decorate-merge-functions-set-module
2 parents 2c69c95 + d770a80 commit d2dd4c1

File tree

26 files changed

+83
-49
lines changed

26 files changed

+83
-49
lines changed

doc/source/development/contributing_docstring.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ Finally, docstrings can also be appended to with the ``doc`` decorator.
940940

941941
In this example, we'll create a parent docstring normally (this is like
942942
``pandas.core.generic.NDFrame``). Then we'll have two children (like
943-
``pandas.core.series.Series`` and ``pandas.DataFrame``). We'll
943+
``pandas.Series`` and ``pandas.DataFrame``). We'll
944944
substitute the class names in this docstring.
945945

946946
.. code-block:: python
@@ -995,5 +995,5 @@ mapping function names to docstrings. Wherever possible, we prefer using
995995
``doc``, since the docstring-writing processes is slightly closer to normal.
996996

997997
See ``pandas.core.generic.NDFrame.fillna`` for an example template, and
998-
``pandas.core.series.Series.fillna`` and ``pandas.core.generic.frame.fillna``
998+
``pandas.Series.fillna`` and ``pandas.core.generic.frame.fillna``
999999
for the filled versions.

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ dependencies:
7777

7878
# code checks
7979
- flake8=7.1.0 # run in subprocess over docstring examples
80-
- mypy=1.11.2 # pre-commit uses locally installed mypy
80+
- mypy=1.13.0 # pre-commit uses locally installed mypy
8181
- tokenize-rt # scripts/check_for_inconsistent_pandas_namespace.py
8282
- pre-commit>=4.0.1
8383

pandas/core/arrays/string_.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@
2828
pa_version_under10p1,
2929
)
3030
from pandas.compat.numpy import function as nv
31-
from pandas.util._decorators import doc
31+
from pandas.util._decorators import (
32+
doc,
33+
set_module,
34+
)
3235
from pandas.util._exceptions import find_stack_level
3336

3437
from pandas.core.dtypes.base import (
@@ -86,6 +89,7 @@
8689
from pandas import Series
8790

8891

92+
@set_module("pandas")
8993
@register_extension_dtype
9094
class StringDtype(StorageExtensionDtype):
9195
"""

pandas/core/computation/ops.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@
7676
class Term:
7777
def __new__(cls, name, env, side=None, encoding=None):
7878
klass = Constant if not isinstance(name, str) else cls
79-
# error: Argument 2 for "super" not an instance of argument 1
80-
supr_new = super(Term, klass).__new__ # type: ignore[misc]
79+
supr_new = super(Term, klass).__new__
8180
return supr_new(klass)
8281

8382
is_local: bool

pandas/core/dtypes/dtypes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,9 +2130,11 @@ def _get_common_dtype(self, dtypes: list[DtypeObj]) -> DtypeObj | None:
21302130
PerformanceWarning,
21312131
stacklevel=find_stack_level(),
21322132
)
2133-
21342133
np_dtypes = (x.subtype if isinstance(x, SparseDtype) else x for x in dtypes)
2135-
return SparseDtype(np_find_common_type(*np_dtypes), fill_value=fill_value)
2134+
# error: Argument 1 to "np_find_common_type" has incompatible type
2135+
# "*Generator[Any | dtype[Any] | ExtensionDtype, None, None]";
2136+
# expected "dtype[Any]" [arg-type]
2137+
return SparseDtype(np_find_common_type(*np_dtypes), fill_value=fill_value) # type: ignore [arg-type]
21362138

21372139

21382140
@register_extension_dtype

pandas/core/generic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8024,7 +8024,9 @@ def asof(self, where, subset=None):
80248024
np.nan, index=self.columns, name=where[0]
80258025
)
80268026

8027-
locs = self.index.asof_locs(where, ~(nulls._values))
8027+
# error: Unsupported operand type for
8028+
# ~ ("ExtensionArray | ndarray[Any, Any] | Any")
8029+
locs = self.index.asof_locs(where, ~nulls._values) # type: ignore[operator]
80288030

80298031
# mask the missing
80308032
mask = locs == -1

pandas/core/groupby/generic.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
Appender,
3333
Substitution,
3434
doc,
35+
set_module,
3536
)
3637
from pandas.util._exceptions import find_stack_level
3738

@@ -108,6 +109,7 @@
108109
ScalarResult = TypeVar("ScalarResult")
109110

110111

112+
@set_module("pandas")
111113
class NamedAgg(NamedTuple):
112114
"""
113115
Helper for column specific aggregation with control over output column names.
@@ -142,6 +144,7 @@ class NamedAgg(NamedTuple):
142144
aggfunc: AggScalar
143145

144146

147+
@set_module("pandas.api.typing")
145148
class SeriesGroupBy(GroupBy[Series]):
146149
def _wrap_agged_manager(self, mgr: Manager) -> Series:
147150
out = self.obj._constructor_from_mgr(mgr, axes=mgr.axes)
@@ -1555,6 +1558,7 @@ def unique(self) -> Series:
15551558
return result
15561559

15571560

1561+
@set_module("pandas.api.typing")
15581562
class DataFrameGroupBy(GroupBy[DataFrame]):
15591563
_agg_examples_doc = dedent(
15601564
"""

pandas/core/indexes/datetimes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,7 @@ def indexer_between_time(
816816
return mask.nonzero()[0]
817817

818818

819+
@set_module("pandas")
819820
def date_range(
820821
start=None,
821822
end=None,
@@ -1020,6 +1021,7 @@ def date_range(
10201021
return DatetimeIndex._simple_new(dtarr, name=name)
10211022

10221023

1024+
@set_module("pandas")
10231025
def bdate_range(
10241026
start=None,
10251027
end=None,

pandas/core/indexes/interval.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,7 @@ def _maybe_convert_i8(self, key):
558558
left = self._maybe_convert_i8(key.left)
559559
right = self._maybe_convert_i8(key.right)
560560
constructor = Interval if scalar else IntervalIndex.from_arrays
561-
# error: "object" not callable
562-
return constructor(left, right, closed=self.closed) # type: ignore[operator]
561+
return constructor(left, right, closed=self.closed)
563562

564563
if scalar:
565564
# Timestamp/Timedelta

pandas/core/indexes/timedeltas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def inferred_type(self) -> str:
237237
return "timedelta64"
238238

239239

240+
@set_module("pandas")
240241
def timedelta_range(
241242
start=None,
242243
end=None,

0 commit comments

Comments
 (0)