Skip to content

Commit

Permalink
Create validate_circuit_classes.py
Browse files Browse the repository at this point in the history
  • Loading branch information
annndruha committed Dec 1, 2023
1 parent 2d9d22f commit 2923b3f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dataset_generator/validate_circuit_classes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import glob
import os.path


def validate_circuit_classes():
folders = glob.glob("circuit_classes/*")
for folder in folders:
top, cls = os.path.split(folder)

cir = os.path.join(folder, cls + '.cir')
png = os.path.join(folder, cls + '.png')
sch = os.path.join(folder, cls + '.sch')

if not os.path.isfile(cir):
raise FileNotFoundError(cir)
if not os.path.isfile(png):
raise FileNotFoundError(png)
if not os.path.isfile(sch):
raise FileNotFoundError(cir)

with open(cir, 'r') as f:
text = ''.join(f.readlines())
if 'input' not in text:
raise ValueError(f'Label "input" doesn\'t exist in "{cir}". Read documentation at 2.2.1(6)')

0 comments on commit 2923b3f

Please sign in to comment.