Exemplo n.º 1
0
def run_file(filename):
    if 'checkpoint' not in filename.name:
        if 'build' not in str(filename.parent):
            with pyfeasst.cd(filename.parent):
                print("Running:", filename, "in", filename.parent)
                pyfeasst.bash_command(
                    "rm tutorial_failures.txt tutorial_log.txt")
                pyfeasst.bash_command(
                    "jupyter nbconvert --to notebook --inplace --ExecutePreprocessor.timeout=10000 --execute "
                    + str(filename) +
                    " > tutorial_log.txt 2>&1; grep \"Error\|Assertion\" tutorial_log.txt >> tutorial_failures.txt"
                )
                pyfeasst.bash_command("grep \"FAILED (fa\" " + str(filename) +
                                      " >> tutorial_failures.txt")
                pyfeasst.bash_command("grep \"Error\" " + str(filename) +
                                      " >> tutorial_failures.txt")
                pyfeasst.bash_command("grep \"ERROR\" " + str(filename) +
                                      " >> tutorial_failures.txt")
                pyfeasst.bash_command("grep \"feasst::CustomException\" " +
                                      str(filename) +
                                      " >> tutorial_failures.txt")
Exemplo n.º 2
0
from pathlib import Path
import feasst
import pyfeasst

pyfeasst.bash_command("rm tutorial_failures.txt")
for filename in Path(feasst.install_dir()).rglob('*.ipynb'):
    if 'checkpoint' not in filename.name:
        with pyfeasst.cd(filename.parent):
            print("Running:", filename, "in", filename.parent)
            pyfeasst.bash_command(
                "jupyter nbconvert --to notebook --inplace --ExecutePreprocessor.timeout=10000 --execute "
                + str(filename))
            pyfeasst.bash_command("grep \"FAILED (fa\" " + str(filename) +
                                  " >> tutorial_failures.txt")
            pyfeasst.bash_command("grep \"Error\" " + str(filename) +
                                  " >> tutorial_failures.txt")
Exemplo n.º 3
0
import re


def read_class(file_name):
    cls = list()
    with open(file_name, 'r') as fle:
        lines = fle.readlines()
        for line in lines:
            if re.search(r'^class ', line) and not re.search(';$', line):
                cls.append(line.split(' ')[1])
    return cls


# obtain the headers sorted by dependency
# write the swig interface file
with pyfeasst.cd(args.source_dir + '/plugin/'):
    deps = bubble_sort(dependency('./'))
    classes = list()
    # note this method for reading classes is copied below for doc
    for dep in deps:
        header = dep[0]
        cls = read_class(header)
        classes.append(cls)

# obtain the headers sorted by dependency
# write the swig interface file
with pyfeasst.cd(args.source_dir + '/plugin/'):
    with open('../py/feasst.i', 'w') as swig_file:
        swig_file.write("/* This is an interface file for swig.\n\
   This file is created by dev/tools/depend.py . Modifications to this\n\
   file will likely be overwritten in the future. Thus, edit depend.py\n\