Skip to content

Commit

Permalink
minor bug fix in the ranking module + nitpicking
Browse files Browse the repository at this point in the history
  • Loading branch information
Péter Volf committed Nov 17, 2017
1 parent 47c3345 commit 63c4d93
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/localclustering/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Cluster(object):
# Initialization
# ------------------------------------------------------------

def __init__(self):
def __init__(self) -> None:
"""
Initialization.
"""
Expand Down
6 changes: 5 additions & 1 deletion src/localclustering/definitions/connectivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class ConnectivityGainDescriptor(GainDescriptor):
# Initialization
# ------------------------------------------------------------

def __init__(self, node: Node, result: bool, weighting_coefficient: float, coefficient_multiplier: float = 0):
def __init__(self,
node: Node,
result: bool,
weighting_coefficient: float,
coefficient_multiplier: float = 0) -> None:
"""
Initialization.
Expand Down
2 changes: 1 addition & 1 deletion src/localclustering/definitions/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GainDescriptor(object):
# Initialization
# ------------------------------------------------------------

def __init__(self, node: Node, result: bool):
def __init__(self, node: Node, result: bool) -> None:
"""
Initialization.
Expand Down
2 changes: 1 addition & 1 deletion src/localclustering/hierarchicalengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class HierarchicalClusterEngine(object):
# Initialization
# ------------------------------------------------------------

def __init__(self):
def __init__(self) -> None:
"""
Initialization.
"""
Expand Down
13 changes: 7 additions & 6 deletions src/localclustering/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

from operator import attrgetter

from localclustering.definitions.util import GainDescriptor
from graphscraper.base import Node

from localclustering.definitions.util import GainDescriptor

# Module constants
# ------------------------------------------------------------

Expand All @@ -29,7 +30,7 @@ class StepDescriptor(object):
# Initialization
# ------------------------------------------------------------

def __init__(self):
def __init__(self) -> None:
"""
Initialization.
"""
Expand All @@ -46,16 +47,16 @@ def __str__(self) -> str:
The string representation of the object.
"""
result: List[str] =\
["Added: {} - {}".format(descriptor.node.name.encode("utf8"), descriptor.coefficient_multiplier)
["Added: {}".format(descriptor.node.name.encode("utf8"))
for descriptor in sorted(self._added_nodes.values(), key=attrgetter("node.name"))]
result.extend(
["Not added: {} - {}".format(descriptor.node.name.encode("utf8"), descriptor.coefficient_multiplier)
["Not added: {}".format(descriptor.node.name.encode("utf8"))
for descriptor in sorted(self._not_added_nodes.values(), key=attrgetter("node.name"))])
result.extend(
["Removed: {} - {}".format(descriptor.node.name.encode("utf8"), descriptor.coefficient_multiplier)
["Removed: {}".format(descriptor.node.name.encode("utf8"))
for descriptor in sorted(self._removed_nodes.values(), key=attrgetter("node.name"))])
result.extend(
["Not removed: {} - {}".format(descriptor.node.name.encode("utf8"), descriptor.coefficient_multiplier)
["Not removed: {}".format(descriptor.node.name.encode("utf8"))
for descriptor in sorted(self._not_removed_nodes.values(), key=attrgetter("node.name"))])
return "\n".join(result)

Expand Down
2 changes: 1 addition & 1 deletion src/localclustering/localengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class LocalClusterEngine(object):
def __init__(self,
cluster_definition: ClusterDefinition = None,
source_nodes_in_result: bool = True,
max_cluster_size: int = 100):
max_cluster_size: int = 100) -> None:
"""
Initialization.
Expand Down
2 changes: 1 addition & 1 deletion src/localclustering/ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class StepHistoryRankProvider(BaseRankProvider):
# Initialization
# ------------------------------------------------------------

def __init__(self, step_history: StepHistory):
def __init__(self, step_history: StepHistory) -> None:
"""
Initialization.
Expand Down

0 comments on commit 63c4d93

Please sign in to comment.