Skip to content

Commit

Permalink
OWLouvain: Make pylint happy
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlin-policar committed Jul 25, 2018
1 parent 311c1cd commit 1beb225
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Orange/widgets/unsupervised/owlouvainclustering.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
from collections import deque
from concurrent.futures import Future # pylint: disable=unused-import
from enum import Enum
from types import SimpleNamespace as namespace
from typing import Optional # pylint: disable=unused-import

import networkx as nx # pylint: disable=unused-import
import numpy as np
import networkx as nx # pylint: disable=unused-import
from AnyQt.QtCore import Qt, pyqtSignal as Signal, QObject
from AnyQt.QtWidgets import QSlider, QCheckBox, QWidget # pylint: disable=unused-import
from types import SimpleNamespace as namespace
from typing import Optional # pylint: disable=unused-import

from Orange.clustering.louvain import table_to_knn_graph, Louvain
from Orange.data import Table, DiscreteVariable
Expand All @@ -23,7 +22,7 @@

try:
from orangecontrib.network.network import Graph
except:
except ImportError:
Graph = None


Expand Down Expand Up @@ -71,11 +70,11 @@ def start(self):
self.on_cancel.emit()
return

def __task_progress(percentage):
current_progress = idx / num_tasks
def __task_progress(percentage, index=idx):
current_progress = index / num_tasks
# How much progress can each task contribute to the total
# work to be done
task_percentage = len(self.__tasks) ** -1
task_percentage = 1 / len(self.__tasks)
# Convert the progress done by the task into the total
# progress to the task
relative_progress = task_percentage * percentage
Expand All @@ -88,7 +87,7 @@ def __task_progress(percentage):
task_spec.task()
self.__set_progress((idx + 1) / num_tasks)

except Exception as e:
except Exception as e: # pylint: disable=broad-except
self.on_exception.emit(e)
return

Expand Down Expand Up @@ -365,7 +364,7 @@ def send_report(self):


if __name__ == '__main__':
from AnyQt.QtWidgets import QApplication
from AnyQt.QtWidgets import QApplication # pylint: disable=ungrouped-imports
import sys

app = QApplication(sys.argv)
Expand Down

0 comments on commit 1beb225

Please sign in to comment.