generated from EPC-MSU/python-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)') |