<commit_before>#!/bin/sh
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd $dir/..

# Update demos constraints
for demo_name in $(ls demos/dlgr/demos/); do
    if [ -f "demos/dlgr/demos/${demo_name}/config.txt" ]; then
        cd "demos/dlgr/demos/${demo_name}/"
        if [ "${demo_name}" = "bartlett1932" ]; then
            # The bartlett1932 experiment is used in docker tests.
            # Its constraints should always be aligned with the ones specified for dallinger
            # in its `requirements.txt`. Hence the special treatment here.
            echo bartlett1932 experiment: copy versions from current `requirements.txt`
            cp $dir/../requirements.txt "$dir/../demos/dlgr/demos/${demo_name}/constraints.txt"
            # Let everyone know this file is up to date.
            # `dallinger.utils.ensure_constraints_file_presence` will check this
            printf "\ndallinger\n# No dallinger== version here\n#Compiled from requirements file with md5sum: $(md5sum "$dir/../demos/dlgr/demos/${demo_name}/requirements.txt")\n" >> "$dir/../demos/dlgr/demos/${demo_name}/constraints.txt"
        else
            echo Compiling ${demo_name}
            dallinger generate-constraints
        fi
        cd -
    fi
done

sed -i -e "s/dallinger==.*/dallinger==$(dallinger --version)/" demos/dlgr/demos/*/constraints.txt<commit_msg>Mac OS compatibility for version update script<commit_after>#!/bin/sh
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cd $dir/..

# Update demos constraints
for demo_name in $(ls demos/dlgr/demos/); do
    if [ -f "demos/dlgr/demos/${demo_name}/config.txt" ]; then
        cd "demos/dlgr/demos/${demo_name}/"
        if [ "${demo_name}" = "bartlett1932" ]; then
            # The bartlett1932 experiment is used in docker tests.
            # Its constraints should always be aligned with the ones specified for dallinger
            # in its `requirements.txt`. Hence the special treatment here.
            echo bartlett1932 experiment: copy versions from current "requirements.txt"
            cp $dir/../requirements.txt "$dir/../demos/dlgr/demos/${demo_name}/constraints.txt"
            # Let everyone know this file is up to date.
            # `dallinger.utils.ensure_constraints_file_presence` will check this
            printf "\ndallinger\n# No dallinger== version here\n#Compiled from requirements file with md5sum: $(md5sum "$dir/../demos/dlgr/demos/${demo_name}/requirements.txt")\n" >> "$dir/../demos/dlgr/demos/${demo_name}/constraints.txt"
        else
            echo Compiling ${demo_name}
            dallinger generate-constraints
        fi
        cd -
    fi
done

sed -i ".orig" -e "s/dallinger==.*/dallinger==$(dallinger --version)/" demos/dlgr/demos/*/constraints.txt
{'fraction_non_alphanumeric': 0.1376679985470396, 'fraction_numerical': 0.010897203051216855, 'mean_word_length': 2.6284584980237153, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '920673', 'n_tokens_mistral': 870, 'n_tokens_neox': 855, 'n_words': 224}