diff --git a/Orange/classification/majority.py b/Orange/classification/majority.py index 212f38b8b0b..0a7f8ba426c 100644 --- a/Orange/classification/majority.py +++ b/Orange/classification/majority.py @@ -33,7 +33,8 @@ def fit_storage(self, dat): probs = np.array(dist) ties = np.flatnonzero(probs == probs.max()) if len(ties) > 1: - random_idx = int(sha1(bytes(dat.Y)).hexdigest(), 16) % len(ties) + random_idx = int(sha1(np.ascontiguousarray(dat.Y).data) + .hexdigest(), 16) % len(ties) unif_maj = ties[random_idx] else: unif_maj = None diff --git a/Orange/classification/rules.py b/Orange/classification/rules.py index 189f0698f73..52a7f068919 100644 --- a/Orange/classification/rules.py +++ b/Orange/classification/rules.py @@ -149,7 +149,8 @@ def hash_dist(x): hash : int Hash function result. """ - return int(sha1(bytes(x)).hexdigest(), base=16) & 0xffffffff + return int(sha1(np.ascontiguousarray(x).data) + .hexdigest(), base=16) & 0xffffffff class Evaluator: diff --git a/Orange/tests/test_preprocess.py b/Orange/tests/test_preprocess.py index 8112e72a34d..60f10120f02 100644 --- a/Orange/tests/test_preprocess.py +++ b/Orange/tests/test_preprocess.py @@ -50,7 +50,11 @@ def test_refuse_data_in_constructor(self): self.assertTrue(os.environ.get('ORANGE_DEPRECATIONS_ERROR')) expected = self.assertRaises if is_CI else self.assertWarns with expected(OrangeDeprecationWarning): - Orange.preprocess.preprocess.Preprocess(Table('iris')) + try: + Orange.preprocess.preprocess.Preprocess(Table('iris')) + except NotImplementedError: + # Expected from default Preprocess.__call__ + pass class RemoveConstant(unittest.TestCase):