Skip to content

Instantly share code, notes, and snippets.

@hansemro
Created November 21, 2023 09:36
Show Gist options
  • Save hansemro/a770402c0657e2c37033373094b38015 to your computer and use it in GitHub Desktop.
Save hansemro/a770402c0657e2c37033373094b38015 to your computer and use it in GitHub Desktop.
Generate scopehal Filter Docs Checklist
#!/usr/bin/env python3
import sys
class Section:
def __init__(self, name:str):
self.name = name
self.has_description = False
self.has_image = False
self.has_inputs = False
self.has_parameters = False
self.has_output = False
def main():
filename = "section-decodes.tex"
f = open(filename, "r")
lines = f.readlines()
sections = []
section = None
for line in lines:
# ignore comment
if "%" in line:
pass
# find section
elif "\section" in line:
if "Introduction" in line:
continue
name = line[9:-2]
section = Section(name)
sections += [section]
# find image
elif "\\bigimage" in line:
section.has_image = True
# find inputs subsection
elif "\subsection{Inputs}" in line:
section.has_inputs = True
# find parameters subsection
elif "\subsection{Parameters}" in line:
section.has_parameters = True
# find output signal subsection
elif "\subsection{Output Signal}" in line:
section.has_output = True
# TODO: find description
for s in sections:
if s.has_image and s.has_inputs and s.has_parameters and s.has_output:
# skip sections with no missing content
#continue
print(f"- [ ] {s.name}")
else:
print(f"- [ ] {s.name}")
print(f" - [ ] has detailed description:")
print(f" - [ ] describe function")
print(f" - [ ] describe theory of operation (and limitations)")
print(f" - [{'x' if s.has_image else ' '}] has image")
print(f" - [{'x' if s.has_inputs else ' '}] has inputs subsection")
print(f" - [{'x' if s.has_parameters else ' '}] has parameters subsection")
print(f" - [{'x' if s.has_output else ' '}] has output signal subsection")
if __name__ == "__main__":
main()
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment