tools/spec: avoid block comment PEP8 warnings for subsections

This commit is contained in:
Danny Robson 2019-01-05 12:19:03 +11:00
parent 06e29cb474
commit babd86aa2b

View File

@ -105,7 +105,7 @@ class AliasType(Type):
return f"using {rename(self.name)} = {rename(self.target)};" return f"using {rename(self.name)} = {rename(self.target)};"
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
class AliasValue(Type): class AliasValue(Type):
""" """
A value that is an alias for another value. A value that is an alias for another value.
@ -124,14 +124,14 @@ class AliasValue(Type):
} }
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
class Placeholder(Type): class Placeholder(Type):
def __init__(self, name: str): def __init__(self, name: str):
super().__init__(name) super().__init__(name)
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
class Unscoped(Type): class Unscoped(Type):
def __init__(self, name: str): def __init__(self, name: str):
super().__init__(name) super().__init__(name)
@ -659,7 +659,7 @@ def parse_types(reg: Registry, root):
reg.types[name].depends.append(t.attrib['requires']) reg.types[name].depends.append(t.attrib['requires'])
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def parse_enums(reg: Registry, root): def parse_enums(reg: Registry, root):
assert root.tag == 'enums' assert root.tag == 'enums'
ownername = root.attrib['name'] ownername = root.attrib['name']
@ -676,7 +676,7 @@ def parse_enums(reg: Registry, root):
owner[valuename] = Constant(node) owner[valuename] = Constant(node)
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def parse_commands(reg: Registry, root): def parse_commands(reg: Registry, root):
assert root.tag == 'commands' assert root.tag == 'commands'
@ -691,7 +691,7 @@ def parse_commands(reg: Registry, root):
reg.types[name] = Command(node) reg.types[name] = Command(node)
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def parse_feature(reg: Registry, root): def parse_feature(reg: Registry, root):
assert root.tag == 'feature' assert root.tag == 'feature'
@ -702,7 +702,7 @@ def parse_feature(reg: Registry, root):
reg.types[name] = reg.features[name] reg.types[name] = reg.features[name]
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def parse_extensions(reg: Registry, root): def parse_extensions(reg: Registry, root):
assert root.tag == 'extensions' assert root.tag == 'extensions'
@ -765,7 +765,7 @@ def write_header(path: str, q: List[Type], reg: Registry):
""") """)
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def write_icd(path: str, q: List[Type], reg: Registry): def write_icd(path: str, q: List[Type], reg: Registry):
with open(path, 'w') as icd: with open(path, 'w') as icd:
commands = [i for i in q if isinstance(i, Command)] commands = [i for i in q if isinstance(i, Command)]
@ -812,7 +812,7 @@ def write_icd(path: str, q: List[Type], reg: Registry):
""") """)
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def write_dispatch(path: str, q: List[Type], reg: Registry): def write_dispatch(path: str, q: List[Type], reg: Registry):
with open(path, 'w') as dispatch: with open(path, 'w') as dispatch:
dispatch.write(""" dispatch.write("""
@ -883,7 +883,7 @@ def write_dispatch(path: str, q: List[Type], reg: Registry):
import argparse import argparse
##----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
def main(): def main():
logging.getLogger().setLevel(logging.WARNING) logging.getLogger().setLevel(logging.WARNING)
@ -939,6 +939,7 @@ def main():
write_icd(args.icd, q, reg) write_icd(args.icd, q, reg)
write_dispatch(args.dispatch, q, reg) write_dispatch(args.dispatch, q, reg)
##-----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
if __name__ == '__main__': if __name__ == '__main__':
main() main()