generate_uaerrors.py
Go to the documentation of this file.
00001 from textwrap import dedent
00002 from generate_statuscode import status_codes
00003 from string import Template
00004 
00005 if __name__ == "__main__":
00006     codes = status_codes()
00007 
00008     with open("../opcua/ua/errors/_auto.py", "w") as f:
00009         preamble = """\
00010         #AUTOGENERATED!!!
00011 
00012         from opcua.ua.uaerrors import UaStatusCodeError
00013         
00014 
00015         """
00016 
00017         f.write(dedent(preamble))
00018 
00019         for name, code, _ in codes:
00020             # skip non-bad because they should not be thrown as exceptions
00021             if not name.startswith("Bad"):
00022                 continue
00023 
00024             template = Template(dedent("""\
00025             class $name(UaStatusCodeError):
00026                 code = $code
00027             """))
00028             print(template.safe_substitute(name=name, code=code), file=f)


ros_opcua_impl_python_opcua
Author(s): Denis Štogl , Daniel Draper
autogenerated on Sat Jun 8 2019 18:26:23