<commit_before>from distutils.command.install import install
from distutils.core import setup
from distutils import log
import os
import json
import sys

kernel_json = {
    "argv": [sys.executable, 
	     "-m", "calysto.language.scheme.kernel", 
	     "-f", "{connection_file}"],
    "display_name": "Calysto Scheme",
    "language": "scheme"
}

class install_with_kernelspec(install):
    def run(self):
        install.run(self)
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        from metakernel.utils.kernel import install_kernel_resources
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755) # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            install_kernel_resources(td, resource="calysto")
            log.info('Installing kernel spec')
            try:
                install_kernel_spec(td, 'calysto_scheme', system=not self.user, replace=True)
            except:
                install_kernel_spec(td, 'calysto_scheme', system=False, replace=True)


svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
    # Die, setuptools, die.
    sys.argv.remove(svem_flag)

setup(name='calysto_scheme',<commit_msg>Install in system by default<commit_after>from distutils.command.install import install
from distutils.core import setup
from distutils import log
import os
import json
import sys

kernel_json = {
    "argv": [sys.executable, 
	     "-m", "calysto.language.scheme.kernel", 
	     "-f", "{connection_file}"],
    "display_name": "Calysto Scheme",
    "language": "scheme"
}

class install_with_kernelspec(install):
    def run(self):
        install.run(self)
        from IPython.kernel.kernelspec import install_kernel_spec
        from IPython.utils.tempdir import TemporaryDirectory
        from metakernel.utils.kernel import install_kernel_resources
        with TemporaryDirectory() as td:
            os.chmod(td, 0o755) # Starts off as 700, not user readable
            with open(os.path.join(td, 'kernel.json'), 'w') as f:
                json.dump(kernel_json, f, sort_keys=True)
            install_kernel_resources(td, resource="calysto")
            log.info('Installing kernel spec')
            try:
                install_kernel_spec(td, 'calysto_scheme', replace=True)
            except:
                install_kernel_spec(td, 'calysto_scheme', user=self.user, replace=True)


svem_flag = '--single-version-externally-managed'
if svem_flag in sys.argv:
    # Die, setuptools, die.
    sys.argv.remove(svem_flag)

setup(name='calysto_scheme',
{'fraction_non_alphanumeric': 0.105533162330524, 'fraction_numerical': 0.005130084279956028, 'mean_word_length': 3.0444444444444443, 'pattern_counts': {'":': 6, '<': 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': '3845450', 'n_tokens_mistral': 866, 'n_tokens_neox': 831, 'n_words': 193}