Skip to content

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

Merged
merged 7 commits into from
Sep 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions pandas/_libs/algos.pyx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# cython: profile=False

from numpy cimport *
cimport numpy as np
import numpy as np

cimport cython
from cython cimport Py_ssize_t

import_array()
np.import_array()

cdef float64_t FP_ERR = 1e-13

Expand All @@ -15,31 +15,19 @@ cimport util
from libc.stdlib cimport malloc, free
from libc.string cimport memmove

from numpy cimport NPY_INT8 as NPY_int8
from numpy cimport NPY_INT16 as NPY_int16
from numpy cimport NPY_INT32 as NPY_int32
from numpy cimport NPY_INT64 as NPY_int64
from numpy cimport NPY_FLOAT16 as NPY_float16
from numpy cimport NPY_FLOAT32 as NPY_float32
from numpy cimport NPY_FLOAT64 as NPY_float64

from numpy cimport (int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t)

int8 = np.dtype(np.int8)
int16 = np.dtype(np.int16)
int32 = np.dtype(np.int32)
int64 = np.dtype(np.int64)
float16 = np.dtype(np.float16)
float32 = np.dtype(np.float32)
float64 = np.dtype(np.float64)
from numpy cimport (ndarray,
NPY_INT64, NPY_UINT64, NPY_INT32, NPY_INT16, NPY_INT8,
NPY_FLOAT32, NPY_FLOAT64,
NPY_OBJECT,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t,
double_t)


cdef double NaN = <double> np.NaN
cdef double nan = NaN

cdef extern from "../src/headers/math.h":
double sqrt(double x) nogil
double fabs(double) nogil
from libc.math cimport sqrt, fabs

# this is our util.pxd
from util cimport numeric, get_nat
Expand Down
9 changes: 5 additions & 4 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# cython: profile=False

from numpy cimport *
cimport numpy as np
cimport numpy as cnp
import numpy as np

cimport cython

import_array()
cnp.import_array()

cimport util

from numpy cimport (int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
from numpy cimport (ndarray,
double_t,
int8_t, int16_t, int32_t, int64_t, uint8_t, uint16_t,
uint32_t, uint64_t, float16_t, float32_t, float64_t)

from libc.stdlib cimport malloc, free
Expand Down
4 changes: 1 addition & 3 deletions pandas/_libs/hashtable.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ from khash cimport (
kh_put_pymap, kh_resize_pymap)


from numpy cimport *
from numpy cimport ndarray, uint8_t, uint32_t

from libc.stdlib cimport malloc, free
from cpython cimport (PyMem_Malloc, PyMem_Realloc, PyMem_Free,
Expand Down Expand Up @@ -56,8 +56,6 @@ cdef extern from "datetime.h":

PyDateTime_IMPORT

cdef extern from "Python.h":
int PySlice_Check(object)

cdef size_t _INIT_VEC_CAP = 128

Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/interval.pyx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
cimport numpy as np
import numpy as np
import pandas as pd

cimport util
cimport cython
import cython
from numpy cimport *
from numpy cimport ndarray
from tslib import Timestamp

from cpython.object cimport (Py_EQ, Py_NE, Py_GT, Py_LT, Py_GE, Py_LE,
Expand Down
8 changes: 6 additions & 2 deletions pandas/_libs/intervaltree.pxi.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ Template for intervaltree
WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
"""

from numpy cimport int64_t, float64_t
from numpy cimport ndarray, PyArray_ArgSort, NPY_QUICKSORT, PyArray_Take
from numpy cimport (
int64_t, int32_t, float64_t, float32_t,
ndarray,
PyArray_ArgSort, NPY_QUICKSORT, PyArray_Take)
import numpy as np

cimport cython
from cython cimport Py_ssize_t

cimport numpy as cnp
cnp.import_array()

Expand Down
23 changes: 4 additions & 19 deletions pandas/_libs/join.pyx
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
# cython: profile=False

from numpy cimport *
cimport numpy as np
import numpy as np

cimport cython
from cython cimport Py_ssize_t

import_array()
np.import_array()

cimport util

from numpy cimport NPY_INT8 as NPY_int8
from numpy cimport NPY_INT16 as NPY_int16
from numpy cimport NPY_INT32 as NPY_int32
from numpy cimport NPY_INT64 as NPY_int64
from numpy cimport NPY_FLOAT16 as NPY_float16
from numpy cimport NPY_FLOAT32 as NPY_float32
from numpy cimport NPY_FLOAT64 as NPY_float64

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,
uint32_t, uint64_t, float16_t, float32_t, float64_t)

int8 = np.dtype(np.int8)
int16 = np.dtype(np.int16)
int32 = np.dtype(np.int32)
int64 = np.dtype(np.int64)
float16 = np.dtype(np.float16)
float32 = np.dtype(np.float32)
float64 = np.dtype(np.float64)

cdef double NaN = <double> np.NaN
cdef double nan = NaN

Expand Down
23 changes: 4 additions & 19 deletions pandas/_libs/reshape.pyx
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
# cython: profile=False

from numpy cimport *
cimport numpy as np
import numpy as np

cimport cython
from cython cimport Py_ssize_t

import_array()
np.import_array()

cimport util

from numpy cimport NPY_INT8 as NPY_int8
from numpy cimport NPY_INT16 as NPY_int16
from numpy cimport NPY_INT32 as NPY_int32
from numpy cimport NPY_INT64 as NPY_int64
from numpy cimport NPY_FLOAT16 as NPY_float16
from numpy cimport NPY_FLOAT32 as NPY_float32
from numpy cimport NPY_FLOAT64 as NPY_float64

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,
uint32_t, uint64_t, float16_t, float32_t, float64_t)

int8 = np.dtype(np.int8)
int16 = np.dtype(np.int16)
int32 = np.dtype(np.int32)
int64 = np.dtype(np.int64)
float16 = np.dtype(np.float16)
float32 = np.dtype(np.float32)
float64 = np.dtype(np.float64)

cdef double NaN = <double> np.NaN
cdef double nan = NaN

Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/src/reduce.pyx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#cython=False
from numpy cimport *
import numpy as np

from distutils.version import LooseVersion
Expand Down