

def add_examples(list_of_examples, path, example_type=None, skip=None):
    example_path = join(example_dir, path)
    if (skip is not None):
        skip = set(skip)
    for f in os.listdir(example_path):
        flags = 0
        if f.startswith(('_', '.')):
            continue
        elif f.endswith('.py'):
            if (example_type is not None):
                flags |= example_type
            elif (('server' in f) or ('animate' in f)):
                flags |= Flags.server
            else:
                flags |= Flags.file
        elif f.endswith('.ipynb'):
            flags |= Flags.notebook
        else:
            continue
        if ('animate' in f):
            flags |= Flags.animated
            if (flags & Flags.file):
                raise ValueError("file examples can't be animated")
        if (skip and (f in skip)):
            flags |= Flags.skip
        list_of_examples.append((join(example_path, f), flags))
    return list_of_examples

dataset/ETHPy150Open bokeh/bokeh/tests/examples/collect_examples.py add_examples/original