Skip to content

Commit 92d84ee

Browse files
authored
Merge pull request #6506 from ales-erjavec/remove-distutils
Remove use of deprecated distrutils
2 parents d17f021 + 1ef8025 commit 92d84ee

File tree

6 files changed

+9
-28
lines changed

6 files changed

+9
-28
lines changed

Orange/canvas/config.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@
55
import random
66
import uuid
77
import warnings
8-
98
import os
109
import sys
11-
import itertools
12-
from distutils.version import LooseVersion
1310

1411
from typing import Dict, Any, Optional, Iterable, List
1512

@@ -112,7 +109,7 @@ def splash_screen():
112109

113110
version = Config.ApplicationVersion
114111
if version:
115-
version_parsed = LooseVersion(version)
112+
version_parsed = pkg_resources.parse_version(version)
116113
version_comp = version_parsed.version
117114
version = ".".join(map(str, version_comp[:2]))
118115
size = 13

Orange/evaluation/scoring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
--------
66
>>> import Orange
77
>>> data = Orange.data.Table('iris')
8-
>>> learner = Orange.classification.LogisticRegressionLearner()
8+
>>> learner = Orange.classification.LogisticRegressionLearner(solver="liblinear")
99
>>> results = Orange.evaluation.TestOnTrainingData(data, [learner])
1010
1111
"""
@@ -293,7 +293,7 @@ class LogLoss(ClassificationScore):
293293
Examples
294294
--------
295295
>>> Orange.evaluation.LogLoss(results)
296-
array([ 0.3...])
296+
array([0.3...])
297297
298298
"""
299299
__wraps__ = skl_metrics.log_loss

Orange/statistics/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ def bincount(x, weights=None, max_val=None, minlength=0):
116116
values as well, even if they do not appear in the data. However, this will
117117
not truncate the bincount if values larger than `max_count` are found.
118118
>>> bincount([0, 0, 1, 1, 2], max_val=4)
119-
(array([ 2., 2., 1., 0., 0.]), 0.0)
119+
(array([2., 2., 1., 0., 0.]), 0.0)
120120
>>> bincount([0, 1, 2, 3, 4], max_val=2)
121-
(array([ 1., 1., 1., 1., 1.]), 0.0)
121+
(array([1., 1., 1., 1., 1.]), 0.0)
122122
123123
"""
124124
# Store the original matrix before any manipulation to check for sparse

Orange/tests/test_doctest.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import sys
22
import os
3-
import unittest
43
from doctest import DocTestSuite, ELLIPSIS, NORMALIZE_WHITESPACE
5-
from distutils.version import LooseVersion
6-
7-
import numpy
84

95
SKIP_DIRS = (
106
# Skip modules which import and initialize stuff that require QApplication
@@ -55,24 +51,12 @@ def clear(self):
5551
def suite(package):
5652
"""Assemble test suite for doctests in path (recursively)"""
5753
from importlib import import_module
58-
# numpy 1.14 changed array str/repr (NORMALIZE_WHITESPACE does not
59-
# handle this). When 1.15 is released update all docstrings and skip the
60-
# tests for < 1.14.
61-
npversion = LooseVersion(numpy.__version__)
62-
if npversion >= LooseVersion("1.14"):
63-
def setUp(test):
64-
raise unittest.SkipTest("Skip doctest on numpy >= 1.14.0")
65-
else:
66-
def setUp(test):
67-
pass
68-
6954
for module in find_modules(package.__file__):
7055
try:
7156
module = import_module(module)
7257
yield DocTestSuite(module,
7358
globs=Context(module.__dict__.copy()),
74-
optionflags=ELLIPSIS | NORMALIZE_WHITESPACE,
75-
setUp=setUp)
59+
optionflags=ELLIPSIS | NORMALIZE_WHITESPACE)
7660
except ValueError:
7761
pass # No doctests in module
7862
except ImportError:

Orange/widgets/evaluate/tests/test_owliftcurve.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# pylint: disable=protected-access,duplicate-code
22
import copy
3+
import pkg_resources
34
import unittest
4-
from distutils.version import LooseVersion
55
from unittest.mock import Mock
66

77
import numpy as np
@@ -26,7 +26,8 @@
2626
# scikit-learn==1.1.1 does not support read the docs, therefore
2727
# we can not make it a requirement for now. When the minimum required
2828
# version is >=1.1.1, delete these exceptions.
29-
OK_SKLEARN = LooseVersion(sklearn.__version__) >= LooseVersion("1.1.1")
29+
OK_SKLEARN = pkg_resources.parse_version(sklearn.__version__) >= \
30+
pkg_resources.parse_version("1.1.1")
3031
SKIP_REASON = "Only test precision-recall with scikit-learn>=1.1.1"
3132

3233

Orange/widgets/evaluate/tests/test_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import unittest
44
import collections
5-
from distutils.version import LooseVersion
65
from itertools import count
76
from unittest.mock import patch
87

0 commit comments

Comments
 (0)