@@ -49,8 +49,8 @@ def __init__(self, data, distance_function, linkage=None):
4949 """
5050 if not linkage :
5151 linkage = 'single'
52- logger .info ("Initializing HierarchicalClustering object with linkage method %s" ,
53- linkage )
52+ logger .info ("Initializing HierarchicalClustering object with linkage "
53+ "method %s" , linkage )
5454 BaseClusterMethod .__init__ (self , data , distance_function )
5555 self .set_linkage_method (linkage )
5656 self .__cluster_created = False
@@ -73,7 +73,7 @@ def set_linkage_method(self, method):
7373 self .linkage = self .uclus_distance
7474 else :
7575 raise ValueError ('distance method must be one of single, '
76- 'complete, average of uclus' )
76+ 'complete, average of uclus' )
7777
7878 def uclus_distance (self , x , y ):
7979 """
@@ -228,7 +228,7 @@ def cluster(self, matrix=None, level=None, sequence=None):
228228 # if we are not on the diagonal (which is always 0)
229229 # and if this cell represents a new minimum...
230230 if ((rowindex != cellindex ) and
231- (cell < mindistance or smallestpair is None )):
231+ (cell < mindistance or smallestpair is None )):
232232 smallestpair = (rowindex , cellindex )
233233 mindistance = cell
234234 cellindex += 1
@@ -237,7 +237,7 @@ def cluster(self, matrix=None, level=None, sequence=None):
237237 sequence += 1
238238 level = matrix [smallestpair [1 ]][smallestpair [0 ]]
239239 cluster = Cluster (level , self ._data [smallestpair [0 ]],
240- self ._data [smallestpair [1 ]])
240+ self ._data [smallestpair [1 ]])
241241
242242 # maintain the data, by combining the the two most similar items
243243 # in the list we use the min and max functions to ensure the
@@ -247,9 +247,9 @@ def cluster(self, matrix=None, level=None, sequence=None):
247247 # value of the second "remove" call, but we don't know the order
248248 # in which they come. The max and min approach clarifies that
249249 self ._data .remove (self ._data [max (smallestpair [0 ],
250- smallestpair [1 ])]) # remove item 1
250+ smallestpair [1 ])]) # remove item 1
251251 self ._data .remove (self ._data [min (smallestpair [0 ],
252- smallestpair [1 ])]) # remove item 2
252+ smallestpair [1 ])]) # remove item 2
253253 self ._data .append (cluster ) # append item 1 and 2 combined
254254
255255 # all the data is in one single cluster. We return that and stop
@@ -277,4 +277,4 @@ def getlevel(self, threshold):
277277 if not self .__cluster_created :
278278 self .cluster ()
279279
280- return self ._data [0 ].getlevel (threshold )
280+ return self ._data [0 ].getlevel (threshold )
0 commit comments