<commit_before>import argparse
import os
import sys

from setuptools import setup, find_packages
from setuptools.command.develop import develop as develop_command
#from setuptools.command.install import install as install_command

from pbr.packaging import parse_requirements
from pbr.packaging import LocalInstall as install_command

MINIMAL = ('Perform the minimal, "localhost discovery" only Satori '
           'installation. i.e exclude heavy dependencies: '
           'novaclient, paramiko, etc.')

def add_option(cls, tag, description, boolean=False):
    """Return tuple of user_options, boolean_options."""
    cls.user_options = [
        (tag, None, description)
    ] + cls.user_options

    if boolean:
        cls.boolean_options = [tag] + cls.boolean_options

    # no dupes
    cls.user_options = list(set(cls.user_options))
    cls.boolean_options = list(set(cls.boolean_options))
    return cls.user_options, cls.boolean_options


class CustomDevelopCommand(develop_command):

    command_name = 'develop'
    user_options, boolean_options = add_option(
        develop_command, 'minimal', MINIMAL, boolean=True)

    def __init__(self, *args, **kwargs):
        self.minimal = None
        develop_command.__init__(self, *args, **kwargs)

    def run(self, *args, **kwargs):
        print "MODIFIED RUN: %s" % self.__class__
        if self.minimal:
            self.distribution.install_requires = (
                parse_requirements(
                    ['minimal-requirements.txt']))
            print "SELF.MINIMAL"
        print "install requires: %s" % (
                self.distribution.install_requires)
        develop_command.run(self, *args, **kwargs)


class CustomInstallCommand(install_command):

    command_name = 'install'
    user_options, boolean_options = add_option(
        install_command, 'minimal', MINIMAL, boolean=True)

    def __init__(self, *args, **kwargs):
        self.minimal = None
        install_command.__init__(self, *args, **kwargs)

    def run(self, *args, **kwargs):
        print "MODIFIED RUN: %s" % self.__class__
        if self.minimal:
            self.distribution.install_requires = (
                parse_requirements(
                    ['minimal-requirements.txt']))
            print "SELF.MINIMAL"
        print "install requires: %s" % (
                self.distribution.install_requires)
        install_command.run(self, *args, **kwargs)
<commit_msg>catch importerror on pbr<commit_after>import argparse
import os
import sys

from setuptools import setup, find_packages
from setuptools.command.develop import develop as develop_command
#from setuptools.command.install import install as install_command

try:
# catch importerror

    from pbr.packaging import parse_requirements
    from pbr.packaging import LocalInstall as install_command

    MINIMAL = ('Perform the minimal, "localhost discovery" only Satori '
            'installation. i.e exclude heavy dependencies: '
            'novaclient, paramiko, etc.')

    def add_option(cls, tag, description, boolean=False):
        """Return tuple of user_options, boolean_options."""
        cls.user_options = [
            (tag, None, description)
        ] + cls.user_options

        if boolean:
            cls.boolean_options = [tag] + cls.boolean_options

        # no dupes
        cls.user_options = list(set(cls.user_options))
        cls.boolean_options = list(set(cls.boolean_options))
        return cls.user_options, cls.boolean_options


    class CustomDevelopCommand(develop_command):

        command_name = 'develop'
        user_options, boolean_options = add_option(
            develop_command, 'minimal', MINIMAL, boolean=True)

        def __init__(self, *args, **kwargs):
            self.minimal = None
            develop_command.__init__(self, *args, **kwargs)

        def run(self, *args, **kwargs):
            print "MODIFIED RUN: %s" % self.__class__
            if self.minimal:
                self.distribution.install_requires = (
                    parse_requirements(
                        ['minimal-requirements.txt']))
                print "SELF.MINIMAL"
            print "install requires: %s" % (
                    self.distribution.install_requires)
            develop_command.run(self, *args, **kwargs)


    class CustomInstallCommand(install_command):

        command_name = 'install'
        user_options, boolean_options = add_option(
            install_command, 'minimal', MINIMAL, boolean=True)

        def __init__(self, *args, **kwargs):
            self.minimal = None
            install_command.__init__(self, *args, **kwargs)

        def run(self, *args, **kwargs):
            print "MODIFIED RUN: %s" % self.__class__
            if self.minimal:
                self.distribution.install_requires = (
                    parse_requirements(
                        ['minimal-requirements.txt']))
                print "SELF.MINIMAL"
            print "install requires: %s" % (
                    self.distribution.install_requires)
            install_command.run(self, *args, **kwargs)

except ImportError:
    pass
{'fraction_non_alphanumeric': 0.09613884555382216, 'fraction_numerical': 0.0, 'mean_word_length': 2.5372413793103448, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '883892', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1385, 'n_words': 341}