Setting all non-zero values to 1 in a CSR matrix is very simple. You do not need any function for it. The 'data' attribute of csr_matrix returns all non_zero values of the matrix; you can use the 'data' attribute to set them to 1.
>>> import numpy as np
>>> from scipy.sparse import csr_matrix
>>> a= np.array([[0,0,2], [-1,0,1], [-2,0,0], [1,0,-1]])
>>> X_all = csr_matrix(a)
>>> X_all.data
array([ 2, -1, 1, -2, 1, -1])
>>> X_all.data[:] = 1
>>> X_all.data
array([1, 1, 1, 1, 1, 1])