def filterFiles(files):

    if os.path.exists("tests/_test_commandline.yaml"):
        config = yaml.load(open("tests/_test_commandline.yaml"))
        if config is not None:
            if "restrict" in config and config["restrict"]:
                values = config["restrict"]
                if "manifest" in values:
                    # take scripts defined in the MANIFEST.in file
                    scriptdirs = [x for x in open("MANIFEST.in")
                                  if x.startswith("include scripts") and
                                  x.endswith(".py\n")]
                    take = set([re.sub("include\s*", "",
                                       x[:-1]) for x in scriptdirs])
                    files = [x for x in files if x in take]

                if "regex" in values:
                    rx = re.compile(values["regex"])
                    files = filter(rx.search, files)
    return files
filter list of files according to filters set in
dataset/ETHPy150Open CGATOxford/cgat/tests/test_commandline.py/filterFiles