core.results¶
- class core.results.Results(app)¶
Manages a collection of duplicate
Group
.This class takes care or marking, sorting and filtering duplicate groups.
- dupes¶
A list of all duplicates (
File
instances), without ref, contained in the currently managedgroups
.
- apply_filter(filter_str)¶
Applies a filter
filter_str
togroups
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 withfilter_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.
- load_from_xml(infile, get_file, j=<hscommon.jobprogress.job.NullJob object>)¶
Load results from
infile
.- Parameters
infile – a file or path pointing to an XML file created with
save_to_xml()
.get_file – a function f(path) returning a
File
wrapping the path.j – A job progress instance.
- 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_duplicates(dupes)¶
Remove
dupes
from their respectiveGroup
.Also, remove the group from
groups
if it ends up empty.
- save_to_xml(outfile)¶
Save results to
outfile
in XML.- Parameters
outfile – file object or path.
- sort_dupes(key, asc=True, delta=False)¶
Sort
dupes
according tokey
.- Parameters
key (str) – key attribute name to sort with.
asc (bool) – If false, sorting is reversed.
delta (bool) – If true, sorting occurs using delta values.