def __call__(self, args):
        """
        Compare two data files and generate a report of their differences.
        """
        self.args = args
        self.field_definitions = load_field_definitions()

        with open(self.args.report_a_path) as f:
            report_a = json.load(f, object_pairs_hook=OrderedDict)

        with open(self.args.report_b_path) as f:
            report_b = json.load(f, object_pairs_hook=OrderedDict)

        diff = self.diff(report_a, report_b)

        output_format = os.path.splitext(self.args.output_path)[1]

        if output_format == '.html':
            with open(self.args.output_path, 'w') as f:
                self.html(diff, f)
        elif output_format == '.json':
            with open(self.args.output_path, 'w') as f:
                json.dump(diff, f, indent=4)
        else:
            raise Exception('Unsupported output format: %s. Must be .html or .json.' % output_format)
dataset/ETHPy150Open onyxfish/clan/clan/diff.py/DiffCommand.__call__/original