<commit_before># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import os

from ..commands import Command
from ..commands.publish import Publish
from ..console import log
from .. import util


def _has_staged_changes(git):
    output = util.check_output([git, 'status', '--porcelain'])
    for line in output.splitlines():
        if line.startswith('M'):
            return True
    return False


class GithubPages(Command):
    @classmethod
    def setup_arguments(cls, subparsers):
        parser = subparsers.add_parser(
            "gh-pages",
            help="""
            Publish the results to Github pages.
            """,
            description="Publish the results to github pages")

        parser.set_defaults(func=cls.run_from_args)

        return parser

    @classmethod
    def run_from_conf_args(cls, conf, args):
        return cls.run(conf=conf)

    @classmethod
    def run(cls, conf):
        # TODO: For transactional integrity, we probably need to check
        # out the repo in a temporary directory
<commit_msg>Use diff-index instead<commit_after># -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

import os

from ..commands import Command
from ..commands.publish import Publish
from ..console import log
from .. import util


def _has_staged_changes(git):
    try:
        util.check_call(
            [git, 'diff-index', '--quiet', '--cached', 'HEAD'],
            display_error=False)
    except util.ProcessError as e:
        if e.retcode == 1:
            return True
        else:
            raise
    return False


class GithubPages(Command):
    @classmethod
    def setup_arguments(cls, subparsers):
        parser = subparsers.add_parser(
            "gh-pages",
            help="""
            Publish the results to Github pages.
            """,
            description="Publish the results to github pages")

        parser.set_defaults(func=cls.run_from_args)

        return parser

    @classmethod
    def run_from_conf_args(cls, conf, args):
        return cls.run(conf=conf)

    @classmethod
    def run(cls, conf):
        # TODO: For transactional integrity, we probably need to check
        # out the repo in a temporary directory

{'fraction_non_alphanumeric': 0.09105495387083835, 'fraction_numerical': 0.0020056157240272766, 'mean_word_length': 2.334224598930481, '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': '313901', 'n_tokens_mistral': 701, 'n_tokens_neox': 682, 'n_words': 217}