Spaces:
Running
Running
File size: 558 Bytes
ba2f5d6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import os
def iter_examples():
"""Iterate over the examples in this directory.
Each item is a dict with the following keys:
- "name" : the unique name of the example
- "filename" : the full file path to the example
"""
example_dir = os.path.abspath(os.path.dirname(__file__))
for filename in os.listdir(example_dir):
name, ext = os.path.splitext(filename)
if name.startswith('_') or ext != '.py':
continue
yield {'name': name,
'filename': os.path.join(example_dir, filename)}
|