<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Dead-simple git repository wrapper for Python

Copyright (c) 2011, <NAME>

License: MIT (see LICENSE.txt for details)
"""
__author__ = '<NAME>'
__license__ = 'MIT'

import os
import subprocess
import shlex

GIT_EXE = '/usr/bin/git'

def execute_git_cmd(cmd, cwd='.'):
    command = [ GIT_EXE ]
    command.extend(shlex.split(cmd))
    output = subprocess.check_output(command, cwd=cwd)
    return output.strip()

class GitRepo(object):
    def __init__(self, path, git_dir='.git'):
        self.path = path
        self.git_dir = git_dir

    @classmethod
    def init(cls, path, git_dir = '.git'):
        command = 'init "%s"' % path
        if git_dir != '.git':
            command += ' --separate-git-dir=%s' % git_dir

        output = execute_git_cmd(command)
        return GitRepo(path, git_dir)

    @property
    def paths(self):
        output = self.git('ls-files')
        paths = output.split('\n')
        return paths

    @property
    def staging(self):
        output = self.git('status --porcelain')
        paths = {}
        for line in output.split('\n'):
            line = line.strip()
            if line:
                status, filepath = line.split()
                paths[filepath] = status
        return paths

    def git(self, command):
        cmd = '--git-dir="%s" %s' % (self.git_dir, command)
        return execute_git_cmd(cmd, self.path)

    def add(self, path):
        return self.git('add "%s"' % path)

    def add_all(self):
        for file in self.staging.keys():
            self.add(file)

    def commit(self, message):
        return self.git('commit -m "%s"' % message)

<commit_msg>Add homepage to header information<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Dead-simple git repository wrapper for Python

Copyright (c) 2011, <NAME>

License: MIT (see LICENSE.txt for details)
"""
__author__ = '<NAME>'
__license__ = 'MIT'
__url__ = 'https://github.com/siu/git_repo'

import os
import subprocess
import shlex

GIT_EXE = '/usr/bin/git'

def execute_git_cmd(cmd, cwd='.'):
    command = [ GIT_EXE ]
    command.extend(shlex.split(cmd))
    output = subprocess.check_output(command, cwd=cwd)
    return output.strip()

class GitRepo(object):
    def __init__(self, path, git_dir='.git'):
        self.path = path
        self.git_dir = git_dir

    @classmethod
    def init(cls, path, git_dir = '.git'):
        command = 'init "%s"' % path
        if git_dir != '.git':
            command += ' --separate-git-dir=%s' % git_dir

        output = execute_git_cmd(command)
        return GitRepo(path, git_dir)

    @property
    def paths(self):
        output = self.git('ls-files')
        paths = output.split('\n')
        return paths

    @property
    def staging(self):
        output = self.git('status --porcelain')
        paths = {}
        for line in output.split('\n'):
            line = line.strip()
            if line:
                status, filepath = line.split()
                paths[filepath] = status
        return paths

    def git(self, command):
        cmd = '--git-dir="%s" %s' % (self.git_dir, command)
        return execute_git_cmd(cmd, self.path)

    def add(self, path):
        return self.git('add "%s"' % path)

    def add_all(self):
        for file in self.staging.keys():
            self.add(file)

    def commit(self, message):
        return self.git('commit -m "%s"' % message)


{'fraction_non_alphanumeric': 0.1431864016133679, 'fraction_numerical': 0.002881014116969173, 'mean_word_length': 2.290995260663507, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '1616343', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1118, 'n_words': 282}