Skip to content

Commit c3fc67e

Browse files
committed
finalize underscores in example filenames
1 parent 389c03a commit c3fc67e

File tree

1 file changed

+3
-35
lines changed

1 file changed

+3
-35
lines changed

adabot/lib/circuitpython_library_validators.py

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ def validate_contents(self, repo):
639639
def __check_lib_name(repo_name, file_name):
640640
""" Nested function to test example file names.
641641
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.
643643
"""
644644
file_names = set()
645645
file_names.add(file_name)
@@ -654,41 +654,9 @@ def __check_lib_name(repo_name, file_name):
654654

655655
found = False
656656

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"\tRepo name stripped of '_': {repo_name_stripped}\n"
665-
f"\tRebuilt example name: {name_rebuilt}\n"
666-
f"\tMatch: {match}"
657+
return any(
658+
name.startswith(repo_name) for name in file_names
667659
)
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"\tExample file name: {name}\tMatch: {found}"
687-
)
688-
689-
return found
690-
##
691-
"""
692660

693661
lib_name_start = repo["name"].rfind("CircuitPython_") + 14
694662
lib_name = repo["name"][lib_name_start:].lower()

0 commit comments

Comments
 (0)