-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Remove from numpy cimport * #17521
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
Remove from numpy cimport * #17521
Conversation
pandas/_libs/algos.pyx
Outdated
cdef extern from "../src/headers/math.h": | ||
double sqrt(double x) nogil | ||
double fabs(double) nogil | ||
from cpython.math cimport sqrt, fabs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want libc.math
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Just pushed a fix.
pandas/_libs/groupby.pyx
Outdated
@@ -1,16 +1,17 @@ | |||
# cython: profile=False | |||
|
|||
from numpy cimport * | |||
cimport numpy as np |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're inconsistent about this, but at least I prefer the cimport numpy as cnp
, so it is clearer which parts need c-level access (edit: cnp)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming right up.
pandas/_libs/reshape.pyx
Outdated
|
||
from numpy cimport (int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, | ||
from numpy cimport (ndarray, | ||
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Codecov Report
@@ Coverage Diff @@
## master #17521 +/- ##
==========================================
+ Coverage 91.18% 91.23% +0.04%
==========================================
Files 163 163
Lines 49543 49606 +63
==========================================
+ Hits 45177 45256 +79
+ Misses 4366 4350 -16
Continue to review full report at Codecov.
|
looks ok to me. @chris-b1 |
thanks @jbrockmendel |
This reverts commit 138be88.
Replace these imports with explicit imports.
There are a couple of other similar things coming up, splitting them apart for easier review.
There are a couple of places with
cdef extern from "../src/headers/math.h":
but I don't think the path here makes sense. The fact that it works anyway bothers me. This PR changes one such occurrence as a demonstration, leaves the others for the next PR.git diff upstream/master -u -- "*.py" | flake8 --diff