11from collections import deque
22from concurrent .futures import Future # pylint: disable=unused-import
3- from enum import Enum
3+ from types import SimpleNamespace as namespace
4+ from typing import Optional # pylint: disable=unused-import
45
5- import networkx as nx # pylint: disable=unused-import
66import numpy as np
7+ import networkx as nx # pylint: disable=unused-import
78from AnyQt .QtCore import Qt , pyqtSignal as Signal , QObject
89from AnyQt .QtWidgets import QSlider , QCheckBox , QWidget # pylint: disable=unused-import
9- from types import SimpleNamespace as namespace
10- from typing import Optional # pylint: disable=unused-import
1110
1211from Orange .clustering .louvain import table_to_knn_graph , Louvain
1312from Orange .data import Table , DiscreteVariable
2322
2423try :
2524 from orangecontrib .network .network import Graph
26- except :
25+ except ImportError :
2726 Graph = None
2827
2928
@@ -71,11 +70,11 @@ def start(self):
7170 self .on_cancel .emit ()
7271 return
7372
74- def __task_progress (percentage ):
75- current_progress = idx / num_tasks
73+ def __task_progress (percentage , index = idx ):
74+ current_progress = index / num_tasks
7675 # How much progress can each task contribute to the total
7776 # work to be done
78- task_percentage = len (self .__tasks ) ** - 1
77+ task_percentage = 1 / len (self .__tasks )
7978 # Convert the progress done by the task into the total
8079 # progress to the task
8180 relative_progress = task_percentage * percentage
@@ -88,7 +87,7 @@ def __task_progress(percentage):
8887 task_spec .task ()
8988 self .__set_progress ((idx + 1 ) / num_tasks )
9089
91- except Exception as e :
90+ except Exception as e : # pylint: disable=broad-except
9291 self .on_exception .emit (e )
9392 return
9493
@@ -365,7 +364,7 @@ def send_report(self):
365364
366365
367366if __name__ == '__main__' :
368- from AnyQt .QtWidgets import QApplication
367+ from AnyQt .QtWidgets import QApplication # pylint: disable=ungrouped-imports
369368 import sys
370369
371370 app = QApplication (sys .argv )
0 commit comments