<commit_before>'''
Created on Jan 6, 2013

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
'''


from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
from autobuilder.config import *


class SendErrorReport(ShellCommand):
    haltOnFailure = False
    flunkOnFailure = True
    name = "SendErrorReport"
    def __init__(self, factory, argdict=None, **kwargs):
        self.factory = factory
        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        self.timeout = 100000
        kwargs['timeout']=self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
        self.buildername=self.getProperty("buildername")
        self.layerversion_core = self.getProperty("layerversion_core")
        if os.environ.get('ERROR_REPORT_DIR') is None:
            self.errordir=os.path.join(os.path.join(
                            self.workerdir, self.buildername),
                            "build/build/tmp/log/error-report/")
        else:
            self.errordir=os.environ.get('ERROR_REPORT_DIR')
        if self.layerversion_core < "4":
            self.command = "echo 'Skipping Step.'"
        else:
            if str(os.environ.get('ERROR_REPORT_COLLECT')) == "True":
                if os.environ.get('ERROR_REPORT_SERVER') is not None:
                    self.errorreportserver = str(os.environ.get('ERROR_REPORT_SERVER'))
                else: 
                    self.errorreportserver = ""
                self.command = "for x in `ls " + self.errordir +"`; do if [ -d " + self.errordir +"/$x" + " ]; then send-error-report " + self.errordir +"/$x" + self.errorreportserver + "; fi; done" 
            self.description = ["Sending error reports"]
        ShellCommand.start(self)

<commit_msg>SendErrorReport.py: Fix loop logic.<commit_after>'''
Created on Jan 6, 2013

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["<NAME>"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
'''


from buildbot.steps.shell import ShellCommand
from buildbot.process.buildstep import LogLineObserver
from autobuilder.config import *


class SendErrorReport(ShellCommand):
    haltOnFailure = False
    flunkOnFailure = True
    name = "SendErrorReport"
    def __init__(self, factory, argdict=None, **kwargs):
        self.factory = factory
        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
        for k, v in argdict.iteritems():
            setattr(self, k, v)
        # Timeout needs to be passed to LoggingBuildStep as a kwarg
        self.timeout = 100000
        kwargs['timeout']=self.timeout
        ShellCommand.__init__(self, **kwargs)

    def start(self):
        self.workerdir=os.path.join(os.path.join(YOCTO_ABBASE, "yocto-worker"))
        self.buildername=self.getProperty("buildername")
        self.layerversion_core = self.getProperty("layerversion_core")
        if os.environ.get('ERROR_REPORT_DIR') is None:
            self.errordir=os.path.join(os.path.join(
                            self.workerdir, self.buildername),
                            "build/build/tmp/log/error-report/")
        else:
            self.errordir=os.environ.get('ERROR_REPORT_DIR')
        if self.layerversion_core < "4":
            self.command = "echo 'Skipping Step.'"
        else:
            if str(os.environ.get('ERROR_REPORT_COLLECT')) == "True":
                if os.environ.get('ERROR_REPORT_SERVER') is not None:
                    self.errorreportserver = str(os.environ.get('ERROR_REPORT_SERVER'))
                else: 
                    self.errorreportserver = ""
                self.command = "if [ -d " + self.errordir +"/$x" + " ]; then for x in `ls " + self.errordir +"`; do send-error-report " + self.errordir +"/$x" + self.errorreportserver + "; done; fi" 
            self.description = ["Sending error reports"]
        ShellCommand.start(self)


{'fraction_non_alphanumeric': 0.1265389876880985, 'fraction_numerical': 0.010031919744642043, 'mean_word_length': 2.5841503267973858, 'pattern_counts': {'":': 4, '<': 11, '<?xml version=': 0, '>': 9, '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': '1919353', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1349, 'n_words': 275}