<commit_before># -*- coding: utf-8 -*-

"""Reports for image content gap."""


def create(articlelist):
    """Create a report from article list with views

    Args:
        articlelist (list): list of dictionnaries with name and views for
            each article [{'name': 'Foo', 'views': 42}, ...]
    Returns:
        str: wiki code for the report
    """
    reportcode = "== Report ==\n"
    for article in articlelist:
        reportcode += "* [[{0}]] {1}\n".format(article['article'],
                                               article['evaluation'])
    return reportcode


def save(site, pagename, report):
    """Save report on the wiki site as pagename.

    Args:
        site (mwclient.Site): wiki to save to
        pagename (str): name of the page to save the report to
        report (str): surface image content gap report
    """
    page = site.Pages[pagename.decode('utf-8')]
    page.save(report, summary='Content gap report')<commit_msg>Report layout.<commit_after># -*- coding: utf-8 -*-

"""Reports for image content gap."""


def create(articlelist):
    """Create a report from article list with views

    Args:
        articlelist (list): list of dictionnaries with name and views for
            each article [{'name': 'Foo', 'views': 42}, ...]
    Returns:
        str: wiki code for the report
    """
    reportcode = "== Report ==\n"
    reportcode += """{| class="wikitable"\n|-\n! Article\n! Views\n"""
    for article in articlelist:
        reportcode += "|-\n| [[{0}]]\n| {1}\n".format(article['article'],
                                                      article['evaluation'])
    reportcode += "|}\n"
    return reportcode


def save(site, pagename, report):
    """Save report on the wiki site as pagename.

    Args:
        site (mwclient.Site): wiki to save to
        pagename (str): name of the page to save the report to
        report (str): surface image content gap report
    """
    page = site.Pages[pagename.decode('utf-8')]
    page.save(report, summary='Content gap report')
{'fraction_non_alphanumeric': 0.14012738853503184, 'fraction_numerical': 0.005879470847623714, 'mean_word_length': 2.3475409836065575, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2625831', 'n_tokens_mistral': 584, 'n_tokens_neox': 558, 'n_words': 203}