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 (
Fileinstances), without ref, contained in the currently managedgroups.
-
apply_filter(filter_str)¶ Applies a filter
filter_strtogroupsWhen you apply the filter, only dupes with the filename matching
filter_strwill be in in the results. To cancel the filter, just call apply_filter withfilter_strto 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
Filewrapping the path.j – A job progress instance.
-
perform_on_marked(func, remove_from_results)¶ Performs
funcon all marked dupes.If an
EnvironmentErroris raised during the call, the problematic dupe is added to self.problems.- Parameters
remove_from_results (bool) – If true, dupes which had
funcapplied and didn’t cause any problem.
-
remove_duplicates(dupes)¶ Remove
dupesfrom their respectiveGroup.Also, remove the group from
groupsif it ends up empty.
-
save_to_xml(outfile)¶ Save results to
outfilein XML.- Parameters
outfile – file object or path.
-
sort_dupes(key, asc=True, delta=False)¶ Sort
dupesaccording 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.
-