Skip to content

Commit

Permalink
adding numpy.import_array()
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-jansen committed Sep 25, 2024
1 parent dd9b6e8 commit 1c21cb9
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/zipline/_protocol.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cimport numpy as np

import numpy; numpy.import_array()
from zipline.assets._assets cimport Asset


Expand Down
1 change: 1 addition & 0 deletions src/zipline/assets/_assets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import numpy as np
from numpy cimport int64_t
import warnings
cimport numpy as np
import numpy; numpy.import_array()

from zipline.utils.calendar_utils import get_calendar

Expand Down
2 changes: 1 addition & 1 deletion src/zipline/assets/continuous_futures.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ from cpython.object cimport (
Py_LT,
)
from cpython cimport bool

import numpy; numpy.import_array()
from functools import partial

from numpy import array, empty, iinfo
Expand Down
2 changes: 2 additions & 0 deletions src/zipline/data/_adjustments.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ from numpy import (
zeros,
)
from numpy cimport float64_t, int64_t, ndarray
import numpy
numpy.import_array()
from pandas import Timestamp

ctypedef object Timestamp_t
Expand Down
2 changes: 1 addition & 1 deletion src/zipline/data/_equities.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ from numpy cimport (
uint8_t,
)
from numpy.math cimport NAN

import numpy; numpy.import_array()
ctypedef object carray_t
ctypedef object ctable_t
ctypedef object Timestamp_t
Expand Down
1 change: 1 addition & 0 deletions src/zipline/data/_minute_bar_internal.pyx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from numpy cimport ndarray, int64_t
import numpy; numpy.import_array()
from numpy import searchsorted
from cpython cimport bool
cimport cython
Expand Down
1 change: 1 addition & 0 deletions src/zipline/data/_resample.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from cython cimport boundscheck, wraparound
from numpy import finfo, float64, nan, isnan
from numpy cimport intp_t, float64_t, uint32_t
import numpy; numpy.import_array()

@boundscheck(False)
@wraparound(False)
Expand Down
1 change: 1 addition & 0 deletions src/zipline/gens/sim_engine.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

cimport cython
cimport numpy as np
import numpy; numpy.import_array()
import numpy as np
import pandas as pd
from cpython cimport bool
Expand Down
1 change: 1 addition & 0 deletions src/zipline/lib/_factorize.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ from cpython cimport Py_LT
from libc.math cimport log
cimport numpy as np
import numpy as np
np.import_array()

from zipline.utils.numpy_utils import unsigned_int_dtype_with_size_in_bytes

Expand Down
1 change: 1 addition & 0 deletions src/zipline/lib/_float64window.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
float specialization of AdjustedArrayWindow
"""
from numpy cimport float64_t
import numpy; numpy.import_array()
ctypedef float64_t[:, :] databuffer

include "_windowtemplate.pxi"
1 change: 1 addition & 0 deletions src/zipline/lib/_int64window.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
datetime specialization of AdjustedArrayWindow
"""
from numpy cimport int64_t
import numpy; numpy.import_array()

ctypedef int64_t[:, :] databuffer

Expand Down
1 change: 1 addition & 0 deletions src/zipline/lib/_uint8window.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
bool specialization of AdjustedArrayWindow
"""
from numpy cimport uint8_t
import numpy; numpy.import_array()

ctypedef uint8_t[:, :] databuffer

Expand Down
1 change: 1 addition & 0 deletions src/zipline/lib/adjustment.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ from pandas import isnull, Timestamp
cimport numpy as np
from numpy cimport float64_t, uint8_t, int64_t
from numpy import asarray, datetime64, float64, int64, bool_, uint8
import numpy; numpy.import_array()

from zipline.utils.compat import unicode

Expand Down
2 changes: 1 addition & 1 deletion src/zipline/lib/rank.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Functions for ranking and sorting.
"""
cimport cython
cimport numpy as np

import numpy; numpy.import_array()
import numpy as np
from cpython cimport bool
from scipy.stats import rankdata
Expand Down

0 comments on commit 1c21cb9

Please sign in to comment.