<commit_before>#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Decide whether we should re-build tests for a project on master.

Exits with code 1 if there are changes that require a rebuild, 0 if not.
"""

from __future__ import print_function

import os
import sys

from should_rerun_tests import should_run_tests, ShouldRebuild
import tooling


def should_run_deploy(changed_files, task):
    """
    Given a set of changed files, check if we need to run tests.
    """
    should_run_tests(changed_files=changed_files, task=task)

    if (
        task.startswith('sbt-') and
        any(f.startswith('docker/scala_service') in changed_files
    ):
        raise ShouldRebuild(
            'Changes to docker/scala_service mean we should deploy'
        )


if __name__ == '__main__':

    # Travis has an environment variable $TRAVIS_COMMIT_RANGE which tells us
    # the range of commits that this push is testing.  By inspecting its
    # value and passing it to `git diff`, we can determine which files
    # have changed.
    changed_files = tooling.changed_files([os.environ['TRAVIS_COMMIT_RANGE']])
    task = os.environ['TASK']
<commit_msg>Fix SyntaxError in the Travis scripts<commit_after>#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Decide whether we should re-build tests for a project on master.

Exits with code 1 if there are changes that require a rebuild, 0 if not.
"""

from __future__ import print_function

import os
import sys

from should_rerun_tests import should_run_tests, ShouldRebuild
import tooling


def should_run_deploy(changed_files, task):
    """
    Given a set of changed files, check if we need to run tests.
    """
    should_run_tests(changed_files=changed_files, task=task)

    if (
        task.startswith('sbt-') and
        any(f.startswith('docker/scala_service') in changed_files)
    ):
        raise ShouldRebuild(
            'Changes to docker/scala_service mean we should deploy'
        )


if __name__ == '__main__':

    # Travis has an environment variable $TRAVIS_COMMIT_RANGE which tells us
    # the range of commits that this push is testing.  By inspecting its
    # value and passing it to `git diff`, we can determine which files
    # have changed.
    changed_files = tooling.changed_files([os.environ['TRAVIS_COMMIT_RANGE']])
    task = os.environ['TASK']

{'fraction_non_alphanumeric': 0.08429610611895592, 'fraction_numerical': 0.0025673940949935813, 'mean_word_length': 3.4113207547169813, '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': '2247974', 'n_tokens_mistral': 720, 'n_tokens_neox': 696, 'n_words': 245}