in rostran/core/metadata.py [0:0]
def as_dict(self, format=False):
data = {self.type: self.value}
if not format:
return data
if self.type == self.PREDEFINED_PARAMETERS:
sorted_pps = []
for i, pp in enumerate(self.value):
sorted_pp = sorted_data(
pp, scores=self.PREDEFINED_PARAMETERS_KEY_SCORES
)
sorted_pps.append(sorted_pp)
data[self.type] = sorted_pps
if self.type == self.ROS_INTERFACE:
data[self.type] = sorted_data(
self.value, scores=self.ROS_INTERFACE_KEY_SCORES
)
param_groups = self.value.get(self.PARAMETER_GROUPS)
if param_groups:
for i, param_group in enumerate(param_groups):
param_groups[i] = sorted_data(
param_group, scores=self.PARAMETER_GROUP_KEY_SCORES
)
template_tags = self.value.get(self.TEMPLATE_TAGS)
if template_tags:
template_tags.sort()
return data