Skip to content

MAINT: Improve the placeholder annotations for the main numpy namespace (part 3)#18799

Merged
charris merged 5 commits intonumpy:mainfrom
BvB93:palceholder4
Apr 19, 2021
Merged

MAINT: Improve the placeholder annotations for the main numpy namespace (part 3)#18799
charris merged 5 commits intonumpy:mainfrom
BvB93:palceholder4

Conversation

@BvB93
Copy link
Copy Markdown
Member

@BvB93 BvB93 commented Apr 17, 2021

Follow up on #18780:

This PR introduces a number of fixes related to aforementioned PR:

  • The default (object-inherited) class constructor takes no arguments.
  • cast and nbytes will automatically convert DTypeLike keys into a generic subclass.
  • The step default value was missing from np.arange
  • Despite the presence of a class-level __getattr__ method, an object is (unjustly) not
    considered a callable without an explicit __call__ method.

Bas van Beek added 4 commits April 17, 2021 18:08
The default `__new__` is inherited from `object`, which takes no
arguments and is therefore too restrictive
`cast` and `nbytes` are in fact instances of a `dict` subclass that
converts passed `DTypeLike` objects into the actual keys (`np.generic`)
…ly1d`

While the presence of `__getattr__` should be enough to consider an object callable, this is apparently not the case.
@BvB93
Copy link
Copy Markdown
Member Author

BvB93 commented Apr 17, 2021

Any idea what could be going on with the travis failure? (https://travis-ci.com/github/numpy/numpy/jobs/499260617)

@charris
Copy link
Copy Markdown
Member

charris commented Apr 18, 2021

Any idea what could be going on with the travis failure

Don't worry about it, ppc64le wanders in and out of availability.

@charris charris merged commit c6cd162 into numpy:main Apr 19, 2021
@charris
Copy link
Copy Markdown
Member

charris commented Apr 19, 2021

Thanks Bas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants