<commit_before>import time
import re
import json
import pygit2
import errors


def _check_key(key):
    """
    Raise InvalidKey exception if key has leading, trailing,
    or double slashes.
    """
    if '' in key.split('/'):
        raise errors.InvalidKey(key)


class Bucket(object):
    def __init__(self, path, remote=None, author=None, committer=None,
                 timezone_offset=0, credentials=None, loader=None,
                 update=True, dumper=None):
        """
        Load or initialize a repository as a bucket.
        :param path: Local path to load. If the path does not exist,
            clone from remote (if provided) or initialize a new git repo.
        :param remote: (optional) Remote from which to clone. If path already
            exists, ensures remote is equal to the local repo's remote.
        :param author: (optional) A tuple of (user, email) to be used as author
            in commits. Defaults to values returned by git config for user.name
            and user.email.
        :param commmitter: (optional) A tuple of (user, email) to be use as
            committer in commits. Defaults to same as author.
        :param timezone_offset: (optional) Offset from UTC in minutes.
            Defaults to 0.
        :param credentials: A `pygit2.Keypair` or `pygit2.UserPass` instance.
            Required for SSH remotes.

        :raises:
            :class:`RemoteMismatch`<commit_msg>reorder kwargs<commit_after>import time
import re
import json
import pygit2
import errors


def _check_key(key):
    """
    Raise InvalidKey exception if key has leading, trailing,
    or double slashes.
    """
    if '' in key.split('/'):
        raise errors.InvalidKey(key)


class Bucket(object):
    def __init__(self, path, remote=None, author=None, committer=None,
                 timezone_offset=0, credentials=None, loader=None,
                 dumper=None, update=True):
        """
        Load or initialize a repository as a bucket.
        :param path: Local path to load. If the path does not exist,
            clone from remote (if provided) or initialize a new git repo.
        :param remote: (optional) Remote from which to clone. If path already
            exists, ensures remote is equal to the local repo's remote.
        :param author: (optional) A tuple of (user, email) to be used as author
            in commits. Defaults to values returned by git config for user.name
            and user.email.
        :param commmitter: (optional) A tuple of (user, email) to be use as
            committer in commits. Defaults to same as author.
        :param timezone_offset: (optional) Offset from UTC in minutes.
            Defaults to 0.
        :param credentials: A `pygit2.Keypair` or `pygit2.UserPass` instance.
            Required for SSH remotes.

        :raises:
            :class:`RemoteMismatch`
{'fraction_non_alphanumeric': 0.07732497387669801, 'fraction_numerical': 0.0034831069313827935, 'mean_word_length': 2.3629976580796255, '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': '2433243', 'n_tokens_mistral': 781, 'n_tokens_neox': 757, 'n_words': 326}