<commit_before># Copyright 2012-2013 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from buildbot.process import buildstep
from buildbot.process.buildstep import LoggingBuildStep, SUCCESS, FAILURE, EXCEPTION
from buildbot.process.properties import Properties
from buildbot.steps.trigger import Trigger
from twisted.spread import pb
from twisted.internet import defer
from twisted.python import log
import StringIO

from .base import ConfigurableStepMixin


class TravisTrigger(Trigger, ConfigurableStepMixin):

    haltOnFailure = True
    flunkOnFailure = True

    sourceStamps = []
    alwaysUseLatest = False
    updateSourceStamp = True

    def __init__(self, scheduler, **kwargs):
        if "name" not in kwargs:
            kwargs['name'] = 'trigger'
        Trigger.__init__(self, waitForFinish=True, schedulerNames=[scheduler], **kwargs)

    @defer.inlineCallbacks
    def run(self):
        self.config = yield self.getStepConfig()

        rv = yield Trigger.run(self)
        defer.returnValue(rv)

    def getSchedulers(self):
        (triggered_schedulers, invalid_schedulers) = Trigger.getSchedulers(self)
        # baseclass should return one scheduler
        if invalid_schedulers:
            return ([], invalid_schedulers)

        sch = triggered_schedulers[0]
        triggered_schedulers = []

        for env in self.config.matrix:
            props_to_set = Properties()
            for k, v in env.items():
                if k == "env":
                    props_to_set.update(v, ".travis.yml")
                else:
                    props_to_set.setProperty(k, v, ".travis.yml")

            triggered_schedulers.append((sch, props_to_set))
        return triggered_schedulers, []<commit_msg>adapt to better proposed trigger custom api<commit_after># Copyright 2012-2013 Isotoma Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from buildbot.process import buildstep
from buildbot.process.buildstep import LoggingBuildStep, SUCCESS, FAILURE, EXCEPTION
from buildbot.process.properties import Properties
from buildbot.steps.trigger import Trigger
from twisted.spread import pb
from twisted.internet import defer
from twisted.python import log
import StringIO

from .base import ConfigurableStepMixin


class TravisTrigger(Trigger, ConfigurableStepMixin):

    haltOnFailure = True
    flunkOnFailure = True

    sourceStamps = []
    alwaysUseLatest = False
    updateSourceStamp = True

    def __init__(self, scheduler, **kwargs):
        if "name" not in kwargs:
            kwargs['name'] = 'trigger'
        Trigger.__init__(self, waitForFinish=True, schedulerNames=[scheduler], **kwargs)

    @defer.inlineCallbacks
    def run(self):
        self.config = yield self.getStepConfig()

        rv = yield Trigger.run(self)
        defer.returnValue(rv)

    def createTriggerProperties(self, props):
        return props

    def getSchedulersAndProperties(self):
        sch = self.schedulerNames[0]
        triggered_schedulers = []

        for env in self.config.matrix:
            props_to_set = Properties()
            for k, v in env.items():
                if k == "env":
                    props_to_set.update(v, ".travis.yml")
                else:
                    props_to_set.setProperty(k, v, ".travis.yml")

            triggered_schedulers.append((sch, props_to_set))
        return triggered_schedulers
{'fraction_non_alphanumeric': 0.0784850558977869, 'fraction_numerical': 0.00593201003878622, 'mean_word_length': 3.1125703564727956, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5302392', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1172, 'n_words': 395}