|
1 | 1 | import sys |
2 | | -import bisect |
3 | | -import contextlib |
4 | | -import warnings |
5 | 2 | from collections import OrderedDict |
6 | 3 | import pkg_resources |
7 | 4 |
|
8 | 5 | import numpy |
9 | 6 |
|
10 | 7 | from AnyQt.QtWidgets import ( |
11 | | - QWidget, QButtonGroup, QGroupBox, QRadioButton, QSlider, QFocusFrame, |
12 | | - QDoubleSpinBox, QComboBox, QSpinBox, QListView, QDockWidget, QLabel, |
13 | | - QScrollArea, QVBoxLayout, QHBoxLayout, QFormLayout, QSpacerItem, |
14 | | - QSizePolicy, QStyle, QStylePainter, QAction, QLabel, |
15 | | - QApplication, QCheckBox |
| 8 | + QWidget, QButtonGroup, QGroupBox, QRadioButton, QSlider, |
| 9 | + QDoubleSpinBox, QComboBox, QSpinBox, QListView, QLabel, |
| 10 | + QScrollArea, QVBoxLayout, QHBoxLayout, QFormLayout, |
| 11 | + QSizePolicy, QApplication, QCheckBox |
16 | 12 | ) |
17 | 13 |
|
18 | 14 | from AnyQt.QtGui import ( |
19 | | - QCursor, QIcon, QPainter, QPixmap, QStandardItemModel, QStandardItem, |
20 | | - QDrag, QKeySequence |
| 15 | + QIcon, QStandardItemModel, QStandardItem |
21 | 16 | ) |
22 | 17 |
|
23 | 18 | from AnyQt.QtCore import ( |
24 | | - Qt, QObject, QEvent, QSize, QModelIndex, QMimeData, QTimer |
| 19 | + Qt, QEvent, QSize, QMimeData, QTimer |
25 | 20 | ) |
26 | 21 |
|
27 | 22 | from AnyQt.QtCore import pyqtSignal as Signal, pyqtSlot as Slot |
|
34 | 29 | from Orange.widgets import widget, gui, settings |
35 | 30 | from Orange.widgets.utils.overlay import OverlayWidget |
36 | 31 | from Orange.widgets.utils.sql import check_sql_input |
37 | | -from Orange.util import Reprable |
38 | 32 |
|
39 | 33 | from Orange.widgets.data.utils.preprocess import ( |
40 | 34 | BaseEditor, blocked, StandardItemModel, DescriptionRole, |
@@ -271,9 +265,9 @@ class ImputeEditor(BaseEditor): |
271 | 265 |
|
272 | 266 | Imputers = { |
273 | 267 | NoImputation: (None, {}), |
274 | | -# Constant: (None, {"value": 0}) |
| 268 | + # Constant: (None, {"value": 0}) |
275 | 269 | Average: (preprocess.impute.Average(), {}), |
276 | | -# Model: (preprocess.impute.Model, {}), |
| 270 | + # Model: (preprocess.impute.Model, {}), |
277 | 271 | Random: (preprocess.impute.Random(), {}), |
278 | 272 | DropRows: (None, {}) |
279 | 273 | } |
@@ -1175,7 +1169,7 @@ def apply(self): |
1175 | 1169 | self.error() |
1176 | 1170 | try: |
1177 | 1171 | data = preprocessor(self.data) |
1178 | | - except ValueError as e: |
| 1172 | + except (ValueError, ZeroDivisionError) as e: |
1179 | 1173 | self.error(str(e)) |
1180 | 1174 | return |
1181 | 1175 | else: |
@@ -1258,4 +1252,3 @@ def test_main(argv=sys.argv): |
1258 | 1252 |
|
1259 | 1253 | if __name__ == "__main__": |
1260 | 1254 | sys.exit(test_main()) |
1261 | | - |
0 commit comments