mirror of
https://github.com/solokeys/pidcodes.github.com.git
synced 2026-10-28 01:01:28 -07:00
Additional validation.
* Ensure PID directories only have an index.md * Ensure PIDs are valid hex.
This commit is contained in:
3 files changed
+10
No files matched your search
File renamed without changes.
File renamed without changes.
@@ -15,10 +15,20 @@ pid0xxx = set([x.name for x in pid0xxx])
|
||||
|
||||
ok = True
|
||||
|
||||
for index in vid_1209.glob("*/*"):
|
||||
if index.name != "index.md":
|
||||
ok = False
|
||||
print("Invalid file:", index)
|
||||
|
||||
for pid in vid_1209.iterdir():
|
||||
pid = pid.name
|
||||
if pid == "index.md":
|
||||
continue
|
||||
try:
|
||||
int(pid, 16)
|
||||
except ValueError:
|
||||
ok = False
|
||||
print("PID " + pid + " not valid hex. Must be 4 characters 0-9 or A-F.")
|
||||
if pid.upper() != pid:
|
||||
ok = False
|
||||
print("PID must be upper case:", pid)
|
||||
|
||||
Reference in new issue
Block a user