Skip to content
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

ENH: Add annotations for np.core._type_aliases #17584

Merged
merged 2 commits into from
Oct 19, 2020
Merged

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented Oct 19, 2020

This PR adds annotations for the two dictionaries in np.core._type_aliases:

  • sctypes
  • sctypeDict

Besides aforementioned dictionaries there is also the allTypes dict.
It doesn't appear to be exposed to the main numpy namespace though and is therefore ignored.

uint: List[Type[unsignedinteger]]
float: List[Type[floating]]
complex: List[Type[complexfloating]]
others: List[type]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
others: List[type]
others: List[Type[generic]]

I think is accurate?

Copy link
Member

Choose a reason for hiding this comment

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

Nope, I'm wrong. Seems like a good argument to never use sctypes to me, but that's out of scope for this PR...

@eric-wieser
Copy link
Member

Besides aforementioned dictionaries there is also the allTypes dict.
It doesn't appear to be exposed to the main numpy namespace though and is therefore ignored.

You're correct, only its contents are exposed:

.. data:: allTypes
A dictionary of names to types that will be exposed as attributes through
``np.core.numerictypes.*``

# Now add the types we've determined to this module
for key in allTypes:
globals()[key] = allTypes[key]
__all__.append(key)

@mattip mattip merged commit fb27bd5 into numpy:master Oct 19, 2020
@mattip
Copy link
Member

mattip commented Oct 19, 2020

Thanks @BvB93

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.

3 participants