Skip to content

Commit 33a0907

Browse files
committed
update example checker
1 parent 69cc72e commit 33a0907

File tree

2 files changed

+138
-128
lines changed

2 files changed

+138
-128
lines changed

examples-check/examples-check.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def find_deepest_directories(directory):
5252

5353
# Walk through the directory
5454
for root, dirs, files in os.walk(directory):
55-
if not dirs:
55+
if [x for x in files if not x.endswith(".json") and not x.startswith("00")]:
5656
deepest_dirs.append(root) # Add to the existing list
5757

5858
return deepest_dirs
@@ -63,9 +63,16 @@ def find_examples_html_in_directories(directories):
6363
for directory in directories:
6464
files = [f for f in os.listdir(directory) if isfile(join(directory, f))]
6565
directory = os.path.relpath(directory, start=str(Path.cwd()))
66-
if all(not file.endswith("Examples.html") for file in files):
66+
example_file = [file for file in files if file.endswith("Examples.html")]
67+
if not example_file:
6768
any_examples[directory] = False
69+
6870
else:
71+
with open(join(directory, example_file[0]), "r", encoding="utf-8") as file:
72+
if file.read().strip().startswith("<div class=\"example-fieldset\">"):
73+
any_examples[directory] = False
74+
continue
75+
6976
any_examples[directory] = True
7077

7178
return any_examples

0 commit comments

Comments
 (0)