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

import os
import sys
import stat
import zipfile
import re
from io import BytesIO

import requests


if __name__ == '__main__':
    if len(sys.argv) != 3 or sys.argv[1] != \
            "--i-accept-the-What-If-Pre-Release-License-Agreement-and-please-take-my-soul":
        print("Sorry, this tool is only meant to be used by automated build systems.")
        print("Please get IACA 'the regular way' from "
              "https://software.intel.com/protected-download/267266/157552")
        print("")
        print("However, if you happen to be an automated build system: "
              "there is something wrong with your configuration.")
        sys.exit(1)

    assert sys.argv[2] in ['lin64', 'mac']
    version = sys.argv[2]

    URL = "https://software.intel.com/protected-download/267266/157552"

    s = requests.Session()
    r = s.get(URL)
    response_data = {
        'accept_license': 1,
        'form_build_id': re.search(r'name="form_build_id" value="([^"]+)" />', r.text).group(1),
        'form_id': 'intel_licensed_dls_step_1'}
    r = s.post(URL, data=response_data)
    download_url = re.search(
        r'"(https://software.intel.com/[^"]*iaca-version-2.2-'+version+'\.zip)"', r.text).group(1)
    print("Downloading", download_url)
    r = s.get(download_url, stream=True)
    zfile = zipfile.ZipFile(BytesIO(r.content))
    members = [n
               for n in zfile.namelist()
               if '/.' not in n and n.startswith('iaca-{:}/'.format(version))]
    zfile.extractall(members=members)

    st = os.stat('iaca-{:}/bin/iaca'.format(version))
    os.chmod(
        'iaca-{:}/bin/iaca'.format(version),
        st.st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
    )<commit_msg>updated to iaca 2.3<commit_after>#!/usr/bin/env python
from __future__ import print_function
from __future__ import absolute_import

import os
import sys
import stat
import zipfile
import re
from io import BytesIO

import requests


if __name__ == '__main__':
    if len(sys.argv) != 3 or sys.argv[1] != \
            "--i-accept-the-What-If-Pre-Release-License-Agreement-and-please-take-my-soul":
        print("Sorry, this tool is only meant to be used by automated build systems.")
        print("Please get IACA 'the regular way' from "
              "https://software.intel.com/protected-download/267266/157552")
        print("")
        print("However, if you happen to be an automated build system: "
              "there is something wrong with your configuration.")
        sys.exit(1)

    assert sys.argv[2] in ['lin64', 'mac']
    version = sys.argv[2]

    URL = "https://software.intel.com/protected-download/267266/157552"

    s = requests.Session()
    r = s.get(URL)
    response_data = {
        'accept_license': 1,
        'form_build_id': re.search(r'name="form_build_id" value="([^"]+)" />', r.text).group(1),
        'form_id': 'intel_licensed_dls_step_1'}
    r = s.post(URL, data=response_data)
    download_url = re.search(
            r'"(https://software.intel.com/[^"]*iaca-version-2.3-'+version+'\.zip)"', r.text).group(1)
    print("Downloading", download_url)
    r = s.get(download_url, stream=True)
    zfile = zipfile.ZipFile(BytesIO(r.content))
    members = [n
               for n in zfile.namelist()
               if '/.' not in n and n.startswith('iaca-{:}/'.format(version))]
    zfile.extractall(members=members)

    st = os.stat('iaca-{:}/bin/iaca'.format(version))
    os.chmod(
        'iaca-{:}/bin/iaca'.format(version),
        st.st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH
    )
{'fraction_non_alphanumeric': 0.1527777777777778, 'fraction_numerical': 0.020697167755991286, 'mean_word_length': 2.814122533748702, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4684557', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1231, 'n_words': 267}