From 257389f3e8796a0873de47ad861e26b24595b62f Mon Sep 17 00:00:00 2001
From: foamyguy <foamyguy@gmail.com>
Date: Tue, 14 Jan 2025 14:00:11 -0600
Subject: [PATCH] filter subdir files by shown type. omit directories if there
 are no shown file types inside of them.

---
 get_imports.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/get_imports.py b/get_imports.py
index c8a3988..3442554 100644
--- a/get_imports.py
+++ b/get_imports.py
@@ -220,11 +220,15 @@ def get_files_for_example(example_path):
                 for _sub_dir in cur_tuple[1]:
                     dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_dir,))
                 for _sub_file in cur_tuple[2]:
-                    dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_file,))
+                    if _sub_file.split(".")[-1] in SHOWN_FILETYPES_EXAMPLE:
+                        dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_file,))
 
         # e.g. ("dir_name", ("file_1.txt", "file_2.txt"))
 
-        if ".circuitpython.skip-screenshot" not in dir_tuple[1]:
+        if (
+            ".circuitpython.skip-screenshot" not in dir_tuple[1]
+            and len(dir_tuple[1]) > 0
+        ):
             found_files.add(dir_tuple)
     return found_files