コード例 #1
0
    def commit(self):
        if self.data is None:
            return

        attr_flags = sum([
            Remove.SortValues * self.sortValues,
            Remove.RemoveConstant * self.removeAttributes,
            Remove.RemoveUnusedValues * self.removeValues
        ])
        class_flags = sum([
            Remove.SortValues * self.sortClasses,
            Remove.RemoveConstant * self.removeClassAttribute,
            Remove.RemoveUnusedValues * self.removeClasses
        ])
        meta_flags = sum([
            Remove.RemoveConstant * self.removeMetaAttributes,
            Remove.RemoveUnusedValues * self.removeMetaAttributeValues
        ])
        remover = Remove(attr_flags, class_flags, meta_flags)
        data = remover(self.data)
        attr_res, class_res, meta_res = remover.attr_results, remover.class_results, remover.meta_results

        self.removedAttrs = attr_res['removed']
        self.reducedAttrs = attr_res['reduced']
        self.resortedAttrs = attr_res['sorted']

        self.removedClasses = class_res['removed']
        self.reducedClasses = class_res['reduced']
        self.resortedClasses = class_res['sorted']

        self.removedMetas = meta_res['removed']
        self.reducedMetas = meta_res['reduced']

        self.send("Data", data)
コード例 #2
0
ファイル: owpurgedomain.py プロジェクト: lhenry15/tods-gui
    def commit(self):
        if self.data is None:
            return

        attr_flags = sum([
            Remove.SortValues * self.sortValues,
            Remove.RemoveConstant * self.removeAttributes,
            Remove.RemoveUnusedValues * self.removeValues
        ])
        class_flags = sum([
            Remove.SortValues * self.sortClasses,
            Remove.RemoveConstant * self.removeClassAttribute,
            Remove.RemoveUnusedValues * self.removeClasses
        ])
        meta_flags = sum([
            Remove.RemoveConstant * self.removeMetaAttributes,
            Remove.RemoveUnusedValues * self.removeMetaAttributeValues
        ])
        remover = Remove(attr_flags, class_flags, meta_flags)
        cleaned = remover(self.data)
        attr_res, class_res, meta_res = \
            remover.attr_results, remover.class_results, remover.meta_results

        self.removedAttrs = attr_res['removed']
        self.reducedAttrs = attr_res['reduced']
        self.resortedAttrs = attr_res['sorted']

        self.removedClasses = class_res['removed']
        self.reducedClasses = class_res['reduced']
        self.resortedClasses = class_res['sorted']

        self.removedMetas = meta_res['removed']
        self.reducedMetas = meta_res['reduced']

        self.info.set_output_summary(len(cleaned),
                                     format_summary_details(cleaned))
        self.Outputs.data.send(cleaned)