mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-16 04:33:59 +00:00
cluster()/_do_clustering(): pass files as tuple instead of list
- the sequence isn't modified anywhere between cluster() and _clustering_finished() (that loops over it)
This commit is contained in:
@@ -1281,15 +1281,15 @@ class Tagger(QtWidgets.QApplication):
|
||||
def cluster(self, objs, callback=None):
|
||||
"""Group files with similar metadata to 'clusters'."""
|
||||
log.debug("Clustering %r", objs)
|
||||
files = iter_files_from_objects(objs)
|
||||
files = tuple(iter_files_from_objects(objs))
|
||||
thread.run_task(
|
||||
partial(self._do_clustering, list(files)),
|
||||
partial(self._do_clustering, files),
|
||||
partial(self._clustering_finished, callback))
|
||||
|
||||
def _do_clustering(self, files):
|
||||
# The clustering algorithm should completely run in the thread,
|
||||
# hence do not return the iterator.
|
||||
return list(Cluster.cluster(files))
|
||||
return tuple(Cluster.cluster(files))
|
||||
|
||||
def _clustering_finished(self, callback, result=None, error=None):
|
||||
if error:
|
||||
|
||||
Reference in New Issue
Block a user