Skip to content

Commit

Permalink
Merge pull request #4 from LeStarch/delivery/formatting
Browse files Browse the repository at this point in the history
Delivery/formatting
  • Loading branch information
LeStarch authored Oct 12, 2020
2 parents 725abcd + 2d5d68f commit 95e6990
Show file tree
Hide file tree
Showing 59 changed files with 602 additions and 509 deletions.
20 changes: 15 additions & 5 deletions Autocoders/Python/bin/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
if isinstance(member_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
serializable_type, member_name, member_type[0][1],
serializable_type,
member_name,
member_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -580,7 +582,9 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -636,7 +640,9 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
if isinstance(channel_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, chan.get_name(), channel_type[0][1],
comp_type,
chan.get_name(),
channel_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -701,7 +707,9 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -764,7 +772,9 @@ def generate_topology(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down
26 changes: 19 additions & 7 deletions Autocoders/Python/bin/gds_dictgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
if isinstance(member_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
serializable_type, member_name, member_type[0][1],
serializable_type,
member_name,
member_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -238,7 +240,9 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -291,7 +295,9 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
if isinstance(channel_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, chan.get_name(), channel_type[0][1],
comp_type,
chan.get_name(),
channel_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down Expand Up @@ -355,7 +361,9 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand All @@ -375,8 +383,10 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
enum_elem.append(enum_mem)
enum_list.append(enum_elem)
# replace enum format string %d with %s for ground system
format_string = DictTypeConverter.DictTypeConverter().format_replace(
format_string, arg_num, "d", "s"
format_string = (
DictTypeConverter.DictTypeConverter().format_replace(
format_string, arg_num, "d", "s"
)
)
else:
type_name = arg_type
Expand Down Expand Up @@ -417,7 +427,9 @@ def generate_xml_dict(the_parsed_topology_xml, xml_filename, opt):
if isinstance(arg_type, tuple):
enum_value = 0
type_name = "{}::{}::{}".format(
comp_type, arg.get_name(), arg_type[0][1],
comp_type,
arg.get_name(),
arg_type[0][1],
)
# Add enum entry
enum_elem = etree.Element("enum")
Expand Down
12 changes: 4 additions & 8 deletions Autocoders/Python/src/fprime_ac/generators/GenFactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,21 @@ def __init__(self, the_type, enabled, generate_code):
self.setGenerateCode(generate_code)

def getEnabled(self):
"""
"""
""""""
return self.__enabled

def getGenerateCode(self):
"""
"""
""""""
return self.__generate_code

def setEnabled(self, enabled):
"""
"""
""""""
if enabled not in (True, False):
raise AttributeError("GenFactory: bad is enabled option")
self.__enabled = enabled

def setGenerateCode(self, generate_code):
"""
"""
""""""
if generate_code not in (True, False):
raise AttributeError("GenFactory: bad generate code option")
self.__generate_code = generate_code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def initInternalInterfaces(self, obj, c):
obj
)
c.internal_interfaces = self.__model_parser.getInternalInterfacesList(obj)
c.internal_interface_param_strs = self.__model_parser.getInternalInterfaceArgsPrototypeStringDict(
obj
c.internal_interface_param_strs = (
self.__model_parser.getInternalInterfaceArgsPrototypeStringDict(obj)
)
c.internal_interface_args_str_dict = c.internal_interface_param_strs
c.internal_interface_args = self.__model_parser.getInternalInterfaceArgsDict(
Expand Down Expand Up @@ -811,8 +811,7 @@ def initTelemetryParams(self, obj, c):

def initTypeIncludes(self, obj, c):
type_includes = [
e.replace("Ai.xml", "Ac.hpp")
for e in obj.get_included_enums()
e.replace("Ai.xml", "Ac.hpp") for e in obj.get_included_enums()
]

for p in obj.get_ports():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,10 @@ def DictBodyVisit(self, obj):
c.ser_import_list.append(ser_import)
# convert format specifier if necessary
if type_name == "enum":
format_string = DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
format_string = (
DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
)
)
# check for an error
if format_string is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ def DictBodyVisit(self, obj, topology_model):
c.ser_import_list.append(ser_import)
# convert format specifier if necessary
if type_name == "enum":
format_string = DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
format_string = (
DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
)
)
# check for an error
if format_string is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ def _get_conv_mem_list(self, obj):
return arg_list

def _get_enum_string_list(self, enum_list):
"""
"""
""""""
enum_tuple = enum_list[0]
enum_list = enum_list[1]
enum_str_list = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def publicVisit(self, obj):
#

if obj.is_ptr:
declaration_template = """{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(
**component
declaration_template = (
"""{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(**component)
)
c.component_declarations.append(declaration_template)
else:
Expand Down Expand Up @@ -382,8 +382,8 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = """{name}_ptr->start(0, 100, 10 * 1024);""".format(
**component
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def publicVisit(self, obj):
c.event_args = self.__model_parser.getEventArgsDict(eobj)
c.event_params = c.event_args
c.event_args_str = self.eventArgsStr()
c.event_param_strs = self.__model_parser.getEventArgsPrototypeStringDict(
eobj
c.event_param_strs = (
self.__model_parser.getEventArgsPrototypeStringDict(eobj)
)
self._writeTmpl(t[0], c, "InstanceTopologyEventsHTML_Visitor")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ def publicVisit(self, obj):
#

if obj.is_ptr:
declaration_template = """{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(
**component
declaration_template = (
"""{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(**component)
)
c.component_declarations.append(declaration_template)
else:
Expand Down Expand Up @@ -389,8 +389,8 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = """{name}_ptr->start(0, 100, 10 * 1024);""".format(
**component
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ def includes2Visit(self, obj):
self._writeTmpl(c, "includes2Visit")

def _get_enum_string_list(self, enum_list):
"""
"""
""""""
enum_tuple = enum_list[0]
enum_list = enum_list[1]
enum_str_list = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def _get_conv_mem_list(self, obj):
return arg_list

def _get_enum_string_list(self, enum_list):
"""
"""
""""""
enum_tuple = enum_list[0]
enum_list = enum_list[1]
enum_str_list = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ def _get_conv_mem_list(self, obj):
return arg_list

def _get_enum_string_list(self, enum_list):
"""
"""
""""""
enum_tuple = enum_list[0]
enum_list = enum_list[1]
enum_str_list = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,8 @@ def publicVisit(self, obj):
#

if obj.is_ptr:
declaration_template = """{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(
**component
declaration_template = (
"""{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(**component)
)
c.component_declarations.append(declaration_template)
else:
Expand Down Expand Up @@ -380,8 +380,8 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = """{name}_ptr->start(0, 100, 10 * 1024);""".format(
**component
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ def publicVisit(self, obj):
#

if obj.is_ptr:
declaration_template = """{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(
**component
declaration_template = (
"""{name}_ptr = new {ns}::{ns}Impl("{name}");""".format(**component)
)
c.component_declarations.append(declaration_template)
else:
Expand Down Expand Up @@ -390,8 +390,8 @@ def publicVisit(self, obj):
startup_template = ""
if component["kind"] == "active":
if obj.is_ptr:
startup_template = """{name}_ptr->start(0, 100, 10 * 1024);""".format(
**component
startup_template = (
"""{name}_ptr->start(0, 100, 10 * 1024);""".format(**component)
)
else:
startup_template = """{name}.start(0, 100, 10 * 1024);""".format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

class AbstractDictWriter:
"""
This abstract class defines the commonality between all autocoded
dictgen files.
"""
This abstract class defines the commonality between all autocoded
dictgen files.
"""

def __init__(self, model):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ def initInternalInterfaces(self, obj, c):
obj
)
c.internal_interfaces = self.__model_parser.getInternalInterfacesList(obj)
c.internal_interface_param_strs = self.__model_parser.getInternalInterfaceArgsPrototypeStringDict(
obj
c.internal_interface_param_strs = (
self.__model_parser.getInternalInterfaceArgsPrototypeStringDict(obj)
)
c.internal_interface_args_str_dict = c.internal_interface_param_strs
c.internal_interface_args = self.__model_parser.getInternalInterfaceArgsDict(
Expand Down Expand Up @@ -818,8 +818,7 @@ def initTelemetryParams(self, obj, c):

def initTypeIncludes(self, obj, c):
type_includes = [
e.replace("Ai.xml", "Ac.hpp")
for e in obj.get_included_enums()
e.replace("Ai.xml", "Ac.hpp") for e in obj.get_included_enums()
]

for p in obj.get_ports():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,10 @@ def DictBodyWrite(self, obj, topology_model):
c.ser_import_list.append(ser_import)
# convert format specifier if necessary
if type_name == "enum":
format_string = DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
format_string = (
DictTypeConverter.DictTypeConverter().format_replace(
c.format_string, arg_num, "d", "s"
)
)
# check for an error
if format_string is None:
Expand Down
Loading

0 comments on commit 95e6990

Please sign in to comment.