From 70354e7e218e8f0e98e602daf21a38fac1385685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavlin=20Poli=C4=8Dar?= Date: Sat, 9 Sep 2017 21:22:42 +0200 Subject: [PATCH] Pylint: Add pylint ignores to more human-friendly formatted matrices --- Orange/statistics/util.py | 2 +- Orange/tests/test_distribution.py | 4 ++++ Orange/tests/test_normalize.py | 2 ++ Orange/tests/test_statistics.py | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Orange/statistics/util.py b/Orange/statistics/util.py index f46999f3c1a..febb27ed10d 100644 --- a/Orange/statistics/util.py +++ b/Orange/statistics/util.py @@ -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' ) diff --git a/Orange/tests/test_distribution.py b/Orange/tests/test_distribution.py index 2209393db10..8a684f297c2 100644 --- a/Orange/tests/test_distribution.py +++ b/Orange/tests/test_distribution.py @@ -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 # -------------------------------------------------------------------------------- @@ -433,6 +434,7 @@ 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) @@ -440,6 +442,7 @@ def test_mean(self): 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) @@ -447,6 +450,7 @@ def test_variance(self): 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) diff --git a/Orange/tests/test_normalize.py b/Orange/tests/test_normalize.py index 150d4255546..b6c42239015 100644 --- a/Orange/tests/test_normalize.py +++ b/Orange/tests/test_normalize.py @@ -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], diff --git a/Orange/tests/test_statistics.py b/Orange/tests/test_statistics.py index fa4a76e2734..35f03158b8a 100644 --- a/Orange/tests/test_statistics.py +++ b/Orange/tests/test_statistics.py @@ -1,6 +1,5 @@ import unittest import warnings - from functools import wraps from itertools import chain @@ -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): @@ -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.], @@ -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],