Skip to content

Conversation

@arw2019
Copy link
Contributor

@arw2019 arw2019 commented Dec 15, 2020

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Spinning off from #38416, xref #38416 (comment)

def apply(
self, func, axis: Axis = 0, raw: bool = False, result_type=None, args=(), **kwds
self,
func: ApplyFuncType,
Copy link
Member

@jorisvandenbossche jorisvandenbossche Dec 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make it explicit, this annotation will show up as Union[np.ufunc, Union[Callable, str, List[Union[Callable, str]], Dict[Union[Hashable, NoneType], Union[Callable, str, List[Union[Callable, str]]]]]]

(kind of unreadable, IMO, but so which is not even complete yet, since the ufunc should be present in each nested case Union[Callable, str]. But isn't a ufunc a callable, so that can maybe be removed?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going off the aggregation case we don't special case ufunc there so we probably shouldn't do it here either.

In that case I think ApplyFuncType is the same as AggFuncType so we can use the same alias in both cases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree here, no need to be different, let's use AggFuncType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

def apply(
self, func, axis: Axis = 0, raw: bool = False, result_type=None, args=(), **kwds
self,
func: ApplyFuncType,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i agree here, no need to be different, let's use AggFuncType

@jreback jreback added the Typing type annotations, mypy/pyright type checking label Dec 16, 2020
@jreback jreback added this to the 1.3 milestone Dec 18, 2020
@jreback jreback merged commit b578be4 into pandas-dev:master Dec 18, 2020
@jreback
Copy link
Contributor

jreback commented Dec 18, 2020

thanks @arw2019

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Typing type annotations, mypy/pyright type checking

3 participants