Skip to content

Commit

Permalink
TYP: remove ignores for "Cannot assign to a method" (#40265)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins authored Mar 8, 2021
1 parent 8e0b744 commit 1c38dfa
Showing 1 changed file with 18 additions and 40 deletions.
58 changes: 18 additions & 40 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -10601,8 +10601,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 @@ -10617,12 +10616,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 @@ -10639,8 +10633,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 @@ -10662,8 +10655,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 @@ -10684,8 +10676,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 @@ -10707,8 +10698,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 @@ -10722,8 +10712,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 @@ -10737,8 +10726,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 @@ -10752,8 +10740,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 @@ -10767,8 +10754,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 @@ -10794,8 +10780,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 @@ -10820,8 +10805,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 @@ -10837,8 +10821,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 @@ -10853,8 +10836,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 @@ -10872,8 +10854,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 @@ -10891,8 +10872,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 @@ -10909,8 +10889,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 @@ -10927,8 +10906,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

0 comments on commit 1c38dfa

Please sign in to comment.