class core.results.Results(app)

Manages a collection of duplicate Group.

This class takes care or marking, sorting and filtering duplicate groups.


The list of Group contained managed by this instance.


A list of all duplicates (File instances), without ref, contained in the currently managed groups.


Applies a filter filter_str to groups

When you apply the filter, only dupes with the filename matching filter_str will be in in the results. To cancel the filter, just call apply_filter with filter_str to None, and the results will go back to normal.

If call apply_filter on a filtered results, the filter will be applied on the filtered results.

Parameters:filter_str (str) – a string containing a regexp to filter dupes with.

Returns Group in which dupe belongs.

load_from_xml(infile, get_file, j=<hscommon.jobprogress.job.NullJob object>)

Load results from infile.


Make dupe take the ref position of its group.

perform_on_marked(func, remove_from_results)

Performs func on all marked dupes.

If an EnvironmentError is raised during the call, the problematic dupe is added to self.problems.

Parameters:remove_from_results (bool) – If true, dupes which had func applied and didn’t cause any problem.

Remove dupes from their respective Group.

Also, remove the group from groups if it ends up empty.


Save results to outfile in XML.

Parameters:outfile – file object or path.
sort_dupes(key, asc=True, delta=False)

Sort dupes according to key.

  • key (str) – key attribute name to sort with.
  • asc (bool) – If false, sorting is reversed.
  • delta (bool) – If true, sorting occurs using delta values.
sort_groups(key, asc=True)

Sort groups according to key.

The ref of each group is used to extract values for sorting.

  • key (str) – key attribute name to sort with.
  • asc (bool) – If false, sorting is reversed.