Skip to content

TYP: remove ignores for "Cannot assign to a method" #40265

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
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
58 changes: 18 additions & 40 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10596,8 +10596,7 @@ def _add_numeric_operations(cls):
def any(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
return NDFrame.any(self, axis, bool_only, skipna, level, **kwargs)

# error: Cannot assign to a method
cls.any = any # type: ignore[assignment]
setattr(cls, "any", any)

@doc(
_bool_doc,
Expand All @@ -10612,12 +10611,7 @@ def any(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
def all(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
return NDFrame.all(self, axis, bool_only, skipna, level, **kwargs)

# error: Cannot assign to a method

# error: Incompatible types in assignment (expression has type
# "Callable[[Iterable[object]], bool]", variable has type "Callable[[NDFrame,
# Any, Any, Any, Any, KwArg(Any)], Any]")
cls.all = all # type: ignore[assignment]
setattr(cls, "all", all)

# error: Argument 1 to "doc" has incompatible type "Optional[str]"; expected
# "Union[str, Callable[..., Any]]"
Expand All @@ -10634,8 +10628,7 @@ def all(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
def mad(self, axis=None, skipna=None, level=None):
return NDFrame.mad(self, axis, skipna, level)

# error: Cannot assign to a method
cls.mad = mad # type: ignore[assignment]
setattr(cls, "mad", mad)

@doc(
_num_ddof_doc,
Expand All @@ -10657,8 +10650,7 @@ def sem(
):
return NDFrame.sem(self, axis, skipna, level, ddof, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.sem = sem # type: ignore[assignment]
setattr(cls, "sem", sem)

@doc(
_num_ddof_doc,
Expand All @@ -10679,8 +10671,7 @@ def var(
):
return NDFrame.var(self, axis, skipna, level, ddof, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.var = var # type: ignore[assignment]
setattr(cls, "var", var)

@doc(
_num_ddof_doc,
Expand All @@ -10702,8 +10693,7 @@ def std(
):
return NDFrame.std(self, axis, skipna, level, ddof, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.std = std # type: ignore[assignment]
setattr(cls, "std", std)

@doc(
_cnum_doc,
Expand All @@ -10717,8 +10707,7 @@ def std(
def cummin(self, axis=None, skipna=True, *args, **kwargs):
return NDFrame.cummin(self, axis, skipna, *args, **kwargs)

# error: Cannot assign to a method
cls.cummin = cummin # type: ignore[assignment]
setattr(cls, "cummin", cummin)

@doc(
_cnum_doc,
Expand All @@ -10732,8 +10721,7 @@ def cummin(self, axis=None, skipna=True, *args, **kwargs):
def cummax(self, axis=None, skipna=True, *args, **kwargs):
return NDFrame.cummax(self, axis, skipna, *args, **kwargs)

# error: Cannot assign to a method
cls.cummax = cummax # type: ignore[assignment]
setattr(cls, "cummax", cummax)

@doc(
_cnum_doc,
Expand All @@ -10747,8 +10735,7 @@ def cummax(self, axis=None, skipna=True, *args, **kwargs):
def cumsum(self, axis=None, skipna=True, *args, **kwargs):
return NDFrame.cumsum(self, axis, skipna, *args, **kwargs)

# error: Cannot assign to a method
cls.cumsum = cumsum # type: ignore[assignment]
setattr(cls, "cumsum", cumsum)

@doc(
_cnum_doc,
Expand All @@ -10762,8 +10749,7 @@ def cumsum(self, axis=None, skipna=True, *args, **kwargs):
def cumprod(self, axis=None, skipna=True, *args, **kwargs):
return NDFrame.cumprod(self, axis, skipna, *args, **kwargs)

# error: Cannot assign to a method
cls.cumprod = cumprod # type: ignore[assignment]
setattr(cls, "cumprod", cumprod)

@doc(
_num_doc,
Expand All @@ -10789,8 +10775,7 @@ def sum(
self, axis, skipna, level, numeric_only, min_count, **kwargs
)

# error: Cannot assign to a method
cls.sum = sum # type: ignore[assignment]
setattr(cls, "sum", sum)

@doc(
_num_doc,
Expand All @@ -10815,8 +10800,7 @@ def prod(
self, axis, skipna, level, numeric_only, min_count, **kwargs
)

# error: Cannot assign to a method
cls.prod = prod # type: ignore[assignment]
setattr(cls, "prod", prod)
cls.product = prod

@doc(
Expand All @@ -10832,8 +10816,7 @@ def prod(
def mean(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
return NDFrame.mean(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.mean = mean # type: ignore[assignment]
setattr(cls, "mean", mean)

@doc(
_num_doc,
Expand All @@ -10848,8 +10831,7 @@ def mean(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
def skew(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
return NDFrame.skew(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.skew = skew # type: ignore[assignment]
setattr(cls, "skew", skew)

@doc(
_num_doc,
Expand All @@ -10867,8 +10849,7 @@ def skew(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
def kurt(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
return NDFrame.kurt(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.kurt = kurt # type: ignore[assignment]
setattr(cls, "kurt", kurt)
cls.kurtosis = kurt

@doc(
Expand All @@ -10886,8 +10867,7 @@ def median(
):
return NDFrame.median(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.median = median # type: ignore[assignment]
setattr(cls, "median", median)

@doc(
_num_doc,
Expand All @@ -10904,8 +10884,7 @@ def median(
def max(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
return NDFrame.max(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.max = max # type: ignore[assignment]
setattr(cls, "max", max)

@doc(
_num_doc,
Expand All @@ -10922,8 +10901,7 @@ def max(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
def min(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
return NDFrame.min(self, axis, skipna, level, numeric_only, **kwargs)

# error: Cannot assign to a method
cls.min = min # type: ignore[assignment]
setattr(cls, "min", min)

@final
@doc(Rolling)
Expand Down