Skip to content

Commit 9c650da

Browse files
committed
remove numpy 1.17.3 freeze
1 parent f8d91ce commit 9c650da

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ name = "feature_mapper"
1919
crate-type = ["cdylib"]
2020

2121
[package.metadata.maturin]
22-
requires-dist = ["scipy~=1.3.0", "cffi~=1.13.0", "numpy<=1.17.3", "numpy-indexed~=0.3.5"]
22+
requires-dist = ["scipy~=1.3.0", "cffi~=1.13.0", "numpy~=1.17.0", "numpy-indexed~=0.3.5"]

feature_mapper/wrapper.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
def C(spm):
88
return dict(shape=spm.shape,
99
indices=(len(spm.indices),
10-
ffi.cast("int32_t *", spm.indices.ctypes.data)),
10+
ffi.from_buffer('int32_t *', spm.indices)),
1111
indptr=(len(spm.indptr),
12-
ffi.cast("int32_t *", spm.indptr.ctypes.data)))
12+
ffi.from_buffer('int32_t *', spm.indptr)))
1313

1414

1515
def Py(c):
1616
return sparse.csr_matrix(
17-
(np.ones(c.indices.len,
18-
dtype=np.bool), ffi.unpack(c.indices.vec, c.indices.len),
17+
(np.ones(c.indices.len, dtype=np.bool), \
18+
ffi.unpack(c.indices.vec, c.indices.len),
1919
ffi.unpack(c.indptr.vec, c.indptr.len)),
2020
shape=(c.shape.rows, c.shape.cols))
2121

@@ -31,17 +31,17 @@ def sparsify(mat):
3131
return sparse.csr_matrix(np.array(mat, dtype=np.int8))
3232

3333

34-
def map_features(spm, im):
34+
def _v(spm, im):
3535
spm = C(sparsify(spm))
3636
im = C(sparsify(im))
3737
assert spm['shape'][1] == im['shape'][1],\
3838
"Number of columns of in-feature and mapping matrices must match."
39-
return Py(lib.remap_rows(spm, im))
39+
return spm, im
40+
41+
42+
def map_features(spm, im):
43+
return Py(lib.remap_rows(*_v(spm, im)))
4044

4145

4246
def map_features_smin(spm, im, smin):
43-
spm = C(sparsify(spm))
44-
im = C(sparsify(im))
45-
assert spm['shape'][1] == im['shape'][1],\
46-
"Number of columns of in-feature and mapping matrices must match."
47-
return Py(lib.remap_rows_smin(spm, im, smin))
47+
return Py(lib.remap_rows_smin(*_v(spm, im), smin))

requirements_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pytest
22
cffi
3-
numpy==1.17.3
3+
numpy
44
numpy-indexed
55
scipy
66
pandas

0 commit comments

Comments
 (0)