Source code for ska_sdp_piper.extensions.common
from dataclasses import dataclass
COL_WIDTHS = [15, 10, 10, 45, 10, 10]
[docs]
@dataclass
class ConfigTableRow:
"""
A helper class to hold values of each row of the configuration table
generated by piper's sphinx extensions.
Each value corresponds to the columns as listed in "HEADERS" constant..
"""
name: str
_type: str
default: str
description: str
nullable: str
allowed_values: str
HEADER_ROW = ConfigTableRow(
"Name",
"Type",
"Default",
"Description",
"Nullable",
"Allowed Values",
)
"""
Defines the header row for the configuration table
"""
[docs]
def dataclass_to_list(dclass_object) -> list:
"""
Return a list containing all the field's values
of a dataclass object. The order is same as the
order defined in dataclass.
"""
return list(dclass_object.__dict__.values())