-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
separate _libs/src/reduce.pyx to _libs.reduction #19306
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
# cython: profile=False | ||
import numpy as np | ||
|
||
from distutils.version import LooseVersion | ||
|
||
from cython cimport Py_ssize_t | ||
from cpython cimport Py_INCREF | ||
|
||
from libc.stdlib cimport malloc, free | ||
|
||
import numpy as np | ||
cimport numpy as np | ||
from numpy cimport (ndarray, | ||
int64_t, | ||
PyArray_SETITEM, | ||
PyArray_ITER_NEXT, PyArray_ITER_DATA, PyArray_IterNew, | ||
flatiter) | ||
np.import_array() | ||
|
||
cimport util | ||
from lib import maybe_convert_objects | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove this, and instead where There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd also need to do that everywhere SeriesGrouper.get_result or SeriesBinGrouper.get_result is called. What's the upside that makes the duplicated code worthwhile? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this completely removes this module from the import time dependency chain. you could do this in the top-level function There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or could expose There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That would be better than trying to do it after every place in the code-base where the function is called. But note that Since the dependency is one-way and not a c-dep, I don't see a huge downside to the import-time import of maybe_convert_objects. |
||
|
||
is_numpy_prior_1_6_2 = LooseVersion(np.__version__) < '1.6.2' | ||
|
||
|
||
|
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.
you don't like reduce?
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 try to avoid overlap with built-in names.