<commit_before>#!/usr/bin/env python
from __future__ import print_function

import os
import sys
import json

from getdep import DependencyTree


SRCROOT = "src"


def open_deps(filepath="DEPS"):
    with open(filepath, "r") as f:
        s = f.read()
        if "# START #" not in s:
            print("Cannot parse DEPS")
            exit(1)
        try:
            return json.loads(s.split("# START #")[1].strip())
        except ValueError:
            print("Cannot parse DEPS")
            exit(1)


def run(cmd):
    print(cmd)
    r = os.system(cmd)
    if r != 0:
        print("Script '{}' failed with error code {}. Exiting".format(cmd, r))
        exit(r)


def force_run(cmd):
    print(cmd)
    r = os.system(cmd)<commit_msg>Don't exit if a sync script fails (e.g. due to the absence of some files in the new revision). TODO: a better fix.<commit_after>#!/usr/bin/env python
from __future__ import print_function

import os
import sys
import json

from getdep import DependencyTree


SRCROOT = "src"


def open_deps(filepath="DEPS"):
    with open(filepath, "r") as f:
        s = f.read()
        if "# START #" not in s:
            print("Cannot parse DEPS")
            exit(1)
        try:
            return json.loads(s.split("# START #")[1].strip())
        except ValueError:
            print("Cannot parse DEPS")
            exit(1)


def run(cmd):
    print(cmd)
    r = os.system(cmd)
    if r != 0:
        print("Script '{}' failed with error code {}. Exiting".format(cmd, r))
#        exit(r)


def force_run(cmd):
    print(cmd)
    r = os.system(cmd)
{'fraction_non_alphanumeric': 0.13068181818181818, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 2.268041237113402, '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': '6659964', 'n_tokens_mistral': 532, 'n_tokens_neox': 517, 'n_words': 157}