@@ -639,7 +639,7 @@ def validate_contents(self, repo):
639
639
def __check_lib_name (repo_name , file_name ):
640
640
""" Nested function to test example file names.
641
641
Allows examples to either match the repo name,
642
- or have underscores separating the repo name.
642
+ or have additional underscores separating the repo name.
643
643
"""
644
644
file_names = set ()
645
645
file_names .add (file_name )
@@ -654,41 +654,9 @@ def __check_lib_name(repo_name, file_name):
654
654
655
655
found = False
656
656
657
- """ Option 1:
658
- Strips underscores from repo name and example name, and makes comparison
659
-
660
- repo_name_stripped = repo_name.replace("_", "")
661
- match = name_rebuilt.startswith(repo_name_stripped)
662
- print(
663
- f"Checking {repo_name} against {file_name}\n "
664
- f"\t Repo name stripped of '_': {repo_name_stripped}\n "
665
- f"\t Rebuilt example name: {name_rebuilt}\n "
666
- f"\t Match: {match}"
657
+ return any (
658
+ name .startswith (repo_name ) for name in file_names
667
659
)
668
- return match
669
- """
670
-
671
- """ Option 2:
672
- Strips underscores from example file name only, adds to set with original
673
- file name, and compares repo name to both example file name versions
674
-
675
- #return any(
676
- # name.startswith(repo_name) for name in file_names
677
- #)
678
-
679
- ## long form only for showing results; 'any' above is the preferred version
680
- print(f"Checking {repo_name} against {file_name} versions:")
681
- for name in file_names:
682
- if name.startswith(repo_name):
683
- found = True
684
-
685
- print(
686
- f"\t Example file name: {name}\t Match: {found}"
687
- )
688
-
689
- return found
690
- ##
691
- """
692
660
693
661
lib_name_start = repo ["name" ].rfind ("CircuitPython_" ) + 14
694
662
lib_name = repo ["name" ][lib_name_start :].lower ()
0 commit comments