<commit_before>#!/usr/bin/env python

# Copyright 2022 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import subprocess
import sys

EMSDK_ROOT = os.path.join('src', 'buildtools', 'emsdk')

EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')

# See lib/web_ui/README.md for instructions on updating the EMSDK version.
EMSDK_VERSION = '3.1.3'


def main():
  try:
    subprocess.check_call([
        sys.executable, EMSDK_PATH, 'install', EMSDK_VERSION
    ])
  except subprocess.CalledProcessError:
    print('Failed to install emsdk')
    return 1
  try:
    subprocess.check_call([
        sys.executable, EMSDK_PATH, 'activate', EMSDK_VERSION
    ])
  except subprocess.CalledProcessError:
    print('Failed to activate emsdk')
    return 1


if __name__ == '__main__':
  sys.exit(main())<commit_msg>Suppress stdout when activating emsdk (#36808)<commit_after>#!/usr/bin/env python

# Copyright 2022 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import subprocess
import sys

EMSDK_ROOT = os.path.join('src', 'buildtools', 'emsdk')

EMSDK_PATH = os.path.join(EMSDK_ROOT, 'emsdk.py')

# See lib/web_ui/README.md for instructions on updating the EMSDK version.
EMSDK_VERSION = '3.1.3'


def main():
  try:
    subprocess.check_call([
        sys.executable, EMSDK_PATH, 'install', EMSDK_VERSION
    ],
                          stdout=subprocess.DEVNULL)
  except subprocess.CalledProcessError:
    print('Failed to install emsdk')
    return 1
  try:
    subprocess.check_call([
        sys.executable, EMSDK_PATH, 'activate', EMSDK_VERSION
    ],
                          stdout=subprocess.DEVNULL)
  except subprocess.CalledProcessError:
    print('Failed to activate emsdk')
    return 1


if __name__ == '__main__':
  sys.exit(main())
{'fraction_non_alphanumeric': 0.10490247759620454, 'fraction_numerical': 0.012124406958355299, 'mean_word_length': 3.4345794392523366, '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': '5251645', 'n_tokens_mistral': 670, 'n_tokens_neox': 614, 'n_words': 172}