<commit_before># -*- coding: utf-8 -*-
"""
Created on Mon Jun  3 12:10:05 2019

@author: Artesia
"""
import os
import shutil

def test_notebooks():
    # get list of notebooks to run
    
    cwd = os.getcwd()
    
    nbdir = os.path.join('examples', 'notebooks')
    os.chdir(nbdir)
    
    testdir = 'build'
    if os.path.isdir(testdir):
        shutil.rmtree(testdir)
    os.mkdir(testdir)
    
    # run each notebook
    files = [f for f in os.listdir() if f.endswith('.ipynb')]
    for file in files:
        try:
            # run autotest on each notebook
            cmd = 'jupyter ' + 'nbconvert ' + \
                  '--ExecutePreprocessor.timeout=600 ' + \
                  '--to ' + 'notebook ' + \
                  '--execute ' + '"{}" '.format(file) + \
                  '--output-dir ' + '{} '.format(testdir)
            ival = os.system(cmd)
            msg = 'could not run {}'.format(file)
            assert ival == 0 and os.path.isfile(os.path.join(testdir,file)), msg
        except Exception as e:
            os.chdir(cwd)
            raise Exception(e)
    os.chdir(cwd)

if __name__ == '__main__':
    test_notebooks()<commit_msg>skip 10_pastas_project.ipynb for now<commit_after># -*- coding: utf-8 -*-
"""
Created on Mon Jun  3 12:10:05 2019

@author: Artesia
"""
import os
import shutil

def test_notebooks():
    # get list of notebooks to run
    
    cwd = os.getcwd()
    
    nbdir = os.path.join('examples', 'notebooks')
    os.chdir(nbdir)
    
    testdir = 'build'
    if os.path.isdir(testdir):
        shutil.rmtree(testdir)
    os.mkdir(testdir)
    
    # run each notebook
    files = [f for f in os.listdir() if f.endswith('.ipynb')]
    for file in files:
        if file not in ['10_pastas_project.ipynb']:
            try:
                # run autotest on each notebook
                cmd = 'jupyter ' + 'nbconvert ' + \
                      '--ExecutePreprocessor.timeout=600 ' + \
                      '--to ' + 'notebook ' + \
                      '--execute ' + '"{}" '.format(file) + \
                      '--output-dir ' + '{} '.format(testdir)
                ival = os.system(cmd)
                msg = 'could not run {}'.format(file)
                assert ival == 0, msg
                assert os.path.isfile(os.path.join(testdir,file)), msg
            except Exception as e:
                os.chdir(cwd)
                raise Exception(e)
    os.chdir(cwd)

if __name__ == '__main__':
    test_notebooks()
{'fraction_non_alphanumeric': 0.13784764207980654, 'fraction_numerical': 0.014510278113663845, 'mean_word_length': 1.6745689655172413, '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': '480292', 'n_tokens_mistral': 866, 'n_tokens_neox': 815, 'n_words': 192}