<commit_before>"""Koztumize's helpers."""
# -*- coding: utf-8 -*-

import pytz
from .application import nuts
from heapq import nlargest
from operator import itemgetter
from datetime import datetime as dt
from urllib import unquote
import locale
from flask import render_template, flash, redirect
locale.setlocale(locale.LC_ALL, 'fr_FR')

TZ_PARIS = pytz.timezone('Europe/Paris')


class NoPermission(Exception):
    """Exception raised for denying access on documents."""


def get_all_commits():
    repo = nuts.document_repository
    read_ref = repo.refs.read_ref
    return (
        {
            'message': commit.message.decode('utf-8'),
            'author': commit.author.decode('utf-8'),
            'date': dt.utcfromtimestamp(commit.commit_time),
            'version': commit.id,
            'ref': tuple(unquote(ref).split('/', 1))}
        for ref in repo.refs.keys(base='refs/heads/documents/')
        for commit in repo.revision_history(
            read_ref('refs/heads/documents/' + ref))
        if commit.parents
    )
<commit_msg>Fix get_all_commits for latest dulwich<commit_after>"""Koztumize's helpers."""
# -*- coding: utf-8 -*-

import pytz
from .application import nuts
from heapq import nlargest
from operator import itemgetter
from datetime import datetime as dt
from urllib import unquote
import locale
from flask import render_template, flash, redirect
locale.setlocale(locale.LC_ALL, 'fr_FR')

TZ_PARIS = pytz.timezone('Europe/Paris')


class NoPermission(Exception):
    """Exception raised for denying access on documents."""


def get_all_commits():
    repo = nuts.document_repository
    read_ref = repo.refs.read_ref
    return (
	{
            'message': result.commit.message.decode('utf-8'),
            'author': result.commit.author.decode('utf-8'),
            'date': dt.utcfromtimestamp(result.commit.commit_time),
            'version': result.commit.id,
            'ref': tuple(unquote(ref).split('/', 1))}
        for ref in repo.refs.keys(base='refs/heads/documents/')
        for result in repo.get_walker(
            read_ref('refs/heads/documents/' + ref))
        if result.commit.parents
    )

{'fraction_non_alphanumeric': 0.12308406874129123, 'fraction_numerical': 0.0037157454714352067, 'mean_word_length': 3.198830409356725, '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': '1736691', 'n_tokens_mistral': 666, 'n_tokens_neox': 634, 'n_words': 162}