<commit_before>import datetime
from bs4 import BeautifulSoup
from collections import OrderedDict
import json
import openpyxl as xl

from django.http.response import HttpResponse

from seqr.views.utils.json_utils import _to_title_case
from xbrowse_server.base.model_utils import _to_snake_case


def export_table(filename_prefix, header, rows, file_format):
    """Generates an HTTP response for a table with the given header and rows, exported into the given file_format.

    Args:
        filename_prefix (string): Filename without the extension.
        header (list): List of column names
        rows (list): List of rows, where each row is a list of column values
        file_format (string): "tsv", "xls", or "json"
    Returns:
        Django HttpResponse object with the table data as an attachment.
    """
    if isinstance(header, dict):
        # it's a mapping of row keys to values
        column_keys = header.keys()
        header = list(header.values())
    else:
        column_keys = header

    for i, row in enumerate(rows):
        if isinstance(row, dict):
            for column_key in column_keys:<commit_msg>fixed codacy issue - unused import<commit_after>import datetime
from bs4 import BeautifulSoup
from collections import OrderedDict
import json
import openpyxl as xl

from django.http.response import HttpResponse

from seqr.views.utils.json_utils import _to_title_case


def export_table(filename_prefix, header, rows, file_format):
    """Generates an HTTP response for a table with the given header and rows, exported into the given file_format.

    Args:
        filename_prefix (string): Filename without the extension.
        header (list): List of column names
        rows (list): List of rows, where each row is a list of column values
        file_format (string): "tsv", "xls", or "json"
    Returns:
        Django HttpResponse object with the table data as an attachment.
    """
    if isinstance(header, dict):
        # it's a mapping of row keys to values
        column_keys = header.keys()
        header = list(header.values())
    else:
        column_keys = header

    for i, row in enumerate(rows):
        if isinstance(row, dict):
            for column_key in column_keys:
{'fraction_non_alphanumeric': 0.067591763652641, 'fraction_numerical': 0.0008952551477170994, 'mean_word_length': 3.177570093457944, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5435699', 'n_tokens_mistral': 611, 'n_tokens_neox': 595, 'n_words': 249}