<commit_before>#!/usr/bin/env python
import os
import os.path
import subprocess

from subprocess import Popen, PIPE

def _set_value(plist_path, key, value):
    subprocess.call(['plutil', '-replace', key, '-string', value, plist_path])

def _get_jdk_home():
    proc = Popen(['/usr/libexec/java_home'], stdout=PIPE)
    return proc.communicate()[0].splitlines()[0]

def _get_android_sdk_home():
    base_dir = os.path.expanduser('/usr/local/Cellar/android-sdk')
    options = os.listdir(base_dir)
    return os.path.join(base_dir, max(options))

if __name__ == '__main__':
    file_path = os.path.expanduser('~/Library/Preferences/com.unity3d.UnityEditor5.x.plist')
    _set_value(file_path, 'CacheServerIPAddress', 'cardscachebox')
    _set_value(file_path, 'JdkPath', _get_jdk_home())
    _set_value(file_path, 'AndroidSdkRoot', _get_android_sdk_home())
<commit_msg>Invalidate cached plist file after changing it<commit_after>#!/usr/bin/env python
import os
import os.path
import subprocess

from subprocess import Popen, PIPE

def _set_value(plist_path, key, value):
    subprocess.call(['plutil', '-replace', key, '-string', value, plist_path])

def _get_jdk_home():
    proc = Popen(['/usr/libexec/java_home'], stdout=PIPE)
    return proc.communicate()[0].splitlines()[0]

def _get_android_sdk_home():
    base_dir = os.path.expanduser('/usr/local/Cellar/android-sdk')
    options = os.listdir(base_dir)
    return os.path.join(base_dir, max(options))

def _invalidate_plist_cache(plist_path):
    subprocess.call(['defaults', 'read', plist_path])


if __name__ == '__main__':
    plist_path = os.path.expanduser('~/Library/Preferences/com.unity3d.UnityEditor5.x.plist')
    _set_value(plist_path, 'CacheServerIPAddress', 'cardscachebox')
    _set_value(plist_path, 'JdkPath', _get_jdk_home())
    _set_value(plist_path, 'AndroidSdkRoot', _get_android_sdk_home())
    _invalidate_plist_cache(plist_path)

{'fraction_non_alphanumeric': 0.1424083769633508, 'fraction_numerical': 0.004188481675392671, 'mean_word_length': 5.544520547945205, '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': '568225', 'n_tokens_mistral': 700, 'n_tokens_neox': 680, 'n_words': 118}