<commit_before>import sys
import os
import tempfile
import shutil
import optparse

import pony_barn.client as pony

class BaseBuild(object):
    def __init__(self):
        self.required = []

    def setup(self):
        "This is where subclasses define extra setup."
        pass

    def define_commands(self):
        "This is where subclasses define how they are run."
        pass

    def execute(self, argv):
        self.add_options()
        self.options, self.args = self.cmdline.parse_args(argv)

        if not self.options.server_url:
            self.server_url = 'http://devmason.com/pony_server/xmlrpc'
        else:
            self.server_url = self.options.server_url

        self.get_tags()
        self.check_build()
        self.context = pony.VirtualenvContext(always_cleanup=self.options.cleanup_temp,
                                              use_site_packages=self.options.site_packages,
                                              dependencies=self.required)
        self.setup()
        self.define_commands()
        results = pony.do(self.name, self.commands, context=self.context)
        return self.report(results)


    def add_options(self):
        self.cmdline = optparse.OptionParser()
        self.cmdline.add_option('-f', '--force-build', dest='force_build',
                           action='store_true', default=False,
                           help="run a build whether or not it's stale")
        self.cmdline.add_option('-r', '--report', dest='report',
                           action='store_false', default=False,
                           help="report build results to server")
        self.cmdline.add_option('-N', '--no-clean-temp', dest='cleanup_temp',
                           action='store_false', default=True,
                           help='do not clean up the temp directory')
        self.cmdline.add_option('-s', '--server-url', dest='server_url',
                           action='store', default='',
                           help='set pony-build server URL for reporting results')
        self.cmdline.add_option('-v', '--verbose', dest='verbose',
                           action='store_true', default=False,
                           help='set verbose reporting')
        self.cmdline.add_option('-P', '--site-packages', dest='site_packages',
                           action='store_true', default=False,
                           help='Use the system site packages')

    def get_tags(self):
        # Figure out the python version and tags
        py_version = ".".join(str(p) for p in sys.version_info[:2])
        self.py_name = 'python%s' % py_version
        self.tags = [self.py_name, 'base_builder']

    def check_build(self):<commit_msg>Actually allow submitting results :)<commit_after>import sys
import os
import tempfile
import shutil
import optparse

import pony_barn.client as pony

class BaseBuild(object):
    def __init__(self):
        self.required = []

    def setup(self):
        "This is where subclasses define extra setup."
        pass

    def define_commands(self):
        "This is where subclasses define how they are run."
        pass

    def execute(self, argv):
        self.add_options()
        self.options, self.args = self.cmdline.parse_args(argv)

        if not self.options.server_url:
            self.server_url = 'http://devmason.com/pony_server/xmlrpc'
        else:
            self.server_url = self.options.server_url

        self.get_tags()
        self.check_build()
        self.context = pony.VirtualenvContext(always_cleanup=self.options.cleanup_temp,
                                              use_site_packages=self.options.site_packages,
                                              dependencies=self.required)
        self.setup()
        self.define_commands()
        results = pony.do(self.name, self.commands, context=self.context)
        return self.report(results)


    def add_options(self):
        self.cmdline = optparse.OptionParser()
        self.cmdline.add_option('-f', '--force-build', dest='force_build',
                           action='store_true', default=False,
                           help="run a build whether or not it's stale")
        self.cmdline.add_option('-r', '--report', dest='report',
                           action='store_true', default=False,
                           help="report build results to server")
        self.cmdline.add_option('-N', '--no-clean-temp', dest='cleanup_temp',
                           action='store_false', default=True,
                           help='do not clean up the temp directory')
        self.cmdline.add_option('-s', '--server-url', dest='server_url',
                           action='store', default='',
                           help='set pony-build server URL for reporting results')
        self.cmdline.add_option('-v', '--verbose', dest='verbose',
                           action='store_true', default=False,
                           help='set verbose reporting')
        self.cmdline.add_option('-P', '--site-packages', dest='site_packages',
                           action='store_true', default=False,
                           help='Use the system site packages')

    def get_tags(self):
        # Figure out the python version and tags
        py_version = ".".join(str(p) for p in sys.version_info[:2])
        self.py_name = 'python%s' % py_version
        self.tags = [self.py_name, 'base_builder']

    def check_build(self):
{'fraction_non_alphanumeric': 0.11192125410134889, 'fraction_numerical': 0.0003645643456069996, 'mean_word_length': 1.883342091434577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4287432', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1438, 'n_words': 327}