Tools: param_parse: add *args and **kwargs to emitters

This commit is contained in:
Peter Barker 2021-04-07 13:12:41 +10:00 committed by Peter Barker
parent 5a927d84c8
commit 229b25d916
8 changed files with 15 additions and 14 deletions

View File

@ -11,7 +11,8 @@ import subprocess
class EDNEmit(Emit):
def __init__(self):
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
self.output = "{:date " + edn_format.dumps(datetime.datetime.now(pytz.utc)) + " "
git = subprocess.Popen(["git log --pretty=format:'%h' -n 1"], shell=True, stdout=subprocess.PIPE).communicate()[0]
self.output += ":git-hash \"" + git.decode("ascii") + "\" "

View File

@ -7,7 +7,7 @@ import re
class Emit:
def __init__(self):
def __init__(self, *args, **kwargs):
pass
prog_values_field = re.compile(r"\s*(-?\w+:\w+)+,*")

View File

@ -13,8 +13,8 @@ except Exception:
class HtmlEmit(Emit):
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
html_fname = 'Parameters.html'
self.f = open(html_fname, mode='w')
self.preamble = """<!-- Dynamically generated list of documented parameters

View File

@ -7,8 +7,8 @@ from emit import Emit
# Emit APM documentation in JSON format
class JSONEmit(Emit):
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
json_fname = 'apm.pdef.json'
self.f = open(json_fname, mode='w')
self.content = {"json": {"version": 0}}

View File

@ -17,8 +17,8 @@ nparams = ['RCn_', 'SERVOn_', 'SRn_', 'BTNn_']
class MDEmit(Emit):
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
fname = 'Parameters.md'
self.nparams = []
self.f = open(fname, mode='w')

View File

@ -20,8 +20,8 @@ This list is automatically generated from the latest ardupilot source code, and
def toolname(self):
return "Tools/autotest/param_metadata/param_parse.py"
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
output_fname = 'Parameters.rst'
self.f = open(output_fname, mode='w')
self.spacer = re.compile("^", re.MULTILINE)

View File

@ -7,8 +7,8 @@ from param import known_param_fields, known_units
# Emit APM documentation in an machine readable XML format
class XmlEmit(Emit):
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
self.wiki_fname = 'apm.pdef.xml'
self.f = open(self.wiki_fname, mode='w')
self.preamble = '''<?xml version="1.0" encoding="utf-8"?>

View File

@ -8,8 +8,8 @@ from lxml import etree
# Emit ArduPilot documentation in an machine readable XML format for Mission Planner
class XmlEmitMP(Emit):
def __init__(self):
Emit.__init__(self)
def __init__(self, *args, **kwargs):
Emit.__init__(self, *args, **kwargs)
self.mp_fname = 'ParameterMetaData.xml'
self.f = open(self.mp_fname, mode='w')
self.preamble = '''<?xml version="1.0" encoding="utf-8"?>\n'''