Skip to content

Commit

Permalink
Pylint: Add pylint ignores to more human-friendly formatted matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlin-policar committed Sep 10, 2017
1 parent 0936f63 commit 70354e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Orange/statistics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def sparse_zero_weights(x, weights):
return weights[zero_indices]
else:
# Can easily be implemented using a coo_matrix
raise NotImplemented(
raise NotImplementedError(
'Computing zero weights on ndimensinal weight matrix is not implemented'
)

Expand Down
4 changes: 4 additions & 0 deletions Orange/tests/test_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ def assert_dist_and_unknowns(computed, goal_dist):
[data.DiscreteVariable("d%i" % i, values=list("abc")) for i in range(10)] +
[data.ContinuousVariable("c%i" % i) for i in range(10)])

# pylint: disable=bad-whitespace
X = sp.csr_matrix(
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
# --------------------------------------------------------------------------------
Expand Down Expand Up @@ -433,20 +434,23 @@ def test_compute_distributions_metas(self):

class TestContinuous(unittest.TestCase):
def test_mean(self):
# pylint: disable=bad-whitespace
x = np.array([[0, 5, 10],
[9, 0, 1]])
dist = distribution.Continuous(x)

self.assertEqual(dist.mean(), np.mean(([0] * 9) + [10]))

def test_variance(self):
# pylint: disable=bad-whitespace
x = np.array([[0, 5, 10],
[9, 0, 1]])
dist = distribution.Continuous(x)

self.assertEqual(dist.variance(), np.var(([0] * 9) + [10]))

def test_standard_deviation(self):
# pylint: disable=bad-whitespace
x = np.array([[0, 5, 10],
[9, 0, 1]])
dist = distribution.Continuous(x)
Expand Down
2 changes: 2 additions & 0 deletions Orange/tests/test_normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ def test_normalize_transform_by_span_zero_class(self):

def test_normalize_sparse(self):
domain = Domain([ContinuousVariable(str(i)) for i in range(3)])
# pylint: disable=bad-whitespace
X = sp.csr_matrix(np.array([
[0, -1, -2],
[0, 1, 2],
]))
data = Table.from_numpy(domain, X)

# pylint: disable=bad-whitespace
solution = sp.csr_matrix(np.array([
[0, -1, -1],
[0, 1, 1],
Expand Down
4 changes: 3 additions & 1 deletion Orange/tests/test_statistics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import unittest
import warnings

from functools import wraps
from itertools import chain

Expand All @@ -13,6 +12,7 @@


def dense_sparse(test_case):
# type: (Callable) -> Callable
"""Run a single test case on both dense and sparse data."""
@wraps(test_case)
def _wrapper(self):
Expand Down Expand Up @@ -182,6 +182,7 @@ def test_var(self):

class TestDigitize(unittest.TestCase):
def setUp(self):
# pylint: disable=bad-whitespace
self.data = [
np.array([
[0., 1., 0., np.nan, 3., 5.],
Expand Down Expand Up @@ -323,6 +324,7 @@ def test_1d_weights_with_axis_1(self, array):

@dense_sparse
def test_2d_weights(self, array):
# pylint: disable=bad-whitespace
x = array([[np.nan, np.nan, 1, 1 ],
[ 0, np.nan, 2, np.nan ]])
w = np.array([[1, 2, 3, 4],
Expand Down

0 comments on commit 70354e7

Please sign in to comment.