def report_one_file(
        self, coverage_data: CoverageData, analysis: Analysis, file_reporter: FileReporter
    ) -> JsonObj:
        """Extract the relevant report data for a single file."""
        nums = analysis.numbers
        self.total += nums
        summary = self.make_summary(nums)
        reported_file: JsonObj = {
            "executed_lines": sorted(analysis.executed),
            "summary": summary,
            "missing_lines": sorted(analysis.missing),
            "excluded_lines": sorted(analysis.excluded),
        }
        if self.config.json_show_contexts:
            reported_file["contexts"] = coverage_data.contexts_by_lineno(analysis.filename)
        if coverage_data.has_arcs():
            summary.update(self.make_branch_summary(nums))
            reported_file["executed_branches"] = list(
                _convert_branch_arcs(analysis.executed_branch_arcs()),
            )
            reported_file["missing_branches"] = list(
                _convert_branch_arcs(analysis.missing_branch_arcs()),
            )

        num_lines = len(file_reporter.source().splitlines())
        for noun, plural in file_reporter.code_region_kinds():
            reported_file[plural] = region_data = {}
            outside_lines = set(range(1, num_lines + 1))
            for region in file_reporter.code_regions():
                if region.kind != noun:
                    continue
                outside_lines -= region.lines
                region_data[region.name] = self.make_region_data(
                    coverage_data,
                    analysis.narrow(region.lines),
                )

            region_data[""] = self.make_region_data(
                coverage_data,
                analysis.narrow(outside_lines),
            )
        return reported_file
Extract the relevant report data for a single file.
coverage/jsonreport.py