10000 ENH: Replace the module-level `__getattr__` with explicit type annotations #17367 by junjunjunk · Pull Request #17406 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Replace the module-level __getattr__ with explicit type annotations #17367 #17406

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 5 commits into from
Oct 1, 2020

Conversation

junjunjunk
Copy link
@junjunjunk junjunjunk commented Sep 30, 2020

Closes #17367 .
Replace the __getattr__ with explicit type annotations in __init__.pyi .

Copy link
Member
@BvB93 BvB93 left a comment

Choose a reason for hiding this comment

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

Looking good overall!
Could you also add a test to .../fail/modules.py to verify that getting a non-existent objects indeed results in an error?
The pre-existing test case in aforementioned module should serve as an example.

@junjunjunk
Copy link
Author

Implemented tests refer to the pre-existing test case which you've told me.
I'm not sure it's correct.Please review.

@junjunjunk
Copy link
Author
junjunjunk commented Sep 30, 2020

python runtests.py --coverage is failed by adding test in CI & my environment (macOS).
The error log shows as below in CI.

AssertionError: Extra error "Module has no attribute" assert 4 in defaultdict(<function test_fail.<locals>.<lambda> at 0x00000233F488F678>, {3: 'C:\hostedtoolcache\windows\Python\3...7.9\x64\lib\site-packages\numpy\typing\tests\data\fail\modules.py:281: error: Module has no attribute "sys"'})

I cannot identify the cause.

Jun Kudo added 2 commits October 1, 2020 11:24
@mattip mattip merged commit d49ecd5 into numpy:master Oct 1, 2020
@mattip
Copy link
Member
mattip commented Oct 1, 2020

Thanks @junjunjunk

@junjunjunk junjunjunk deleted the is17367 branch October 1, 2020 08:00
@junjunjunk
Copy link
Author

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.

ENH: Replace the module-level __getattr__ with explicit type annotations
3 participants
0