<commit_before>"""
    viewer.git
    ~~~~~~~~~~

    Interface to git.

    :copyright: © 2014 by <NAME> <<EMAIL>> and contributors
    :license: BSD, see LICENSE for more details
"""

import subprocess

from .utils import chdir


class Commit:
    """A representation of a git commit."""

    #: The length of a valid hash. Hashes of a different length are not
    #: permitted.
    VALID_HASH_LENGTH = 40

    #: The set of valid hash characters '0123456789abcdef'. Other characters
    #: are not permitted in a hash.
    VALID_HASH_CHARACTERS = set('0123456789abcdef')

    def __init__(self, hash, author, email, date):
        """Creates a commit with the given data.

        :param str hash: Identifier of the commit.
        :param str author: Author of the commit.
        :param str email: Email of the author.
        :param date date: Date the commit was authored.

        The hash is normalized so that it contains only lowercase characters.

        :raises ValueError: If the hash's length differs from
                            :py:attr:`VALID_HASH_LENGTH` or if the hash
                            contains characters out of
                            :py:attr:`VALID_HASH_CHARACTERS`.
        """
        #: Identifier of the commit.
        self.hash = hash
        #: Author of the commit.
        self.author = author
        #: Email of the author.
        self.email = email
        #: Date the commit was authored.
        self.date = date

    @property
    def hash(self):
        return self._hash

    @hash.setter
    def hash(self, new_hash):
        new_hash = self._normalize_hash(new_hash)
        self._validate_hash(new_hash)<commit_msg>git: Remove useless :py domain qualifications in the docs.<commit_after>"""
    viewer.git
    ~~~~~~~~~~

    Interface to git.

    :copyright: © 2014 by <NAME> <<EMAIL>> and contributors
    :license: BSD, see LICENSE for more details
"""

import subprocess

from .utils import chdir


class Commit:
    """A representation of a git commit."""

    #: The length of a valid hash. Hashes of a different length are not
    #: permitted.
    VALID_HASH_LENGTH = 40

    #: The set of valid hash characters '0123456789abcdef'. Other characters
    #: are not permitted in a hash.
    VALID_HASH_CHARACTERS = set('0123456789abcdef')

    def __init__(self, hash, author, email, date):
        """Creates a commit with the given data.

        :param str hash: Identifier of the commit.
        :param str author: Author of the commit.
        :param str email: Email of the author.
        :param date date: Date the commit was authored.

        The hash is normalized so that it contains only lowercase characters.

        :raises ValueError: If the hash's length differs from
                            :attr:`VALID_HASH_LENGTH` or if the hash contains
                            characters out of :attr:`VALID_HASH_CHARACTERS`.
        """
        #: Identifier of the commit.
        self.hash = hash
        #: Author of the commit.
        self.author = author
        #: Email of the author.
        self.email = email
        #: Date the commit was authored.
        self.date = date

    @property
    def hash(self):
        return self._hash

    @hash.setter
    def hash(self, new_hash):
        new_hash = self._normalize_hash(new_hash)
        self._validate_hash(new_hash)
{'fraction_non_alphanumeric': 0.0840011872959335, 'fraction_numerical': 0.01543484713564856, 'mean_word_length': 2.191287878787879, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1917309', 'n_tokens_mistral': 984, 'n_tokens_neox': 891, 'n_words': 357}