Skip to content

Commit

Permalink
list: make it work for parameters that reference unsupported DOPs
Browse files Browse the repository at this point in the history
once all possible DOPs are implemented, this hack should become
unnecessary.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
  • Loading branch information
andlaus committed Jan 19, 2024
1 parent fd6a242 commit a008df6
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions odxtools/cli/_print_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,18 @@ def extract_parameter_tabulation_data(parameters: List[Parameter]) -> Dict[str,
value_type.append('coded values')
dop.append(None)
elif isinstance(param, (PhysicalConstantParameter, SystemParameter, ValueParameter)):
dop.append(param.dop.short_name)
if (tmp := getattr(param, "physical_type", None)) is not None:
data_type.append(tmp.base_data_type.name)
# this is a hack to make this routine work for parameters
# which reference DOPs of a type that a is not yet
# internalized. (all parameter objects of the tested types
# are supposed to have a DOP.)
param_dop = getattr(param, "_dop", None)

if param_dop is not None:
dop.append(param_dop.short_name)

if param_dop is not None and (phys_type := getattr(param, "physical_type",
None)) is not None:
data_type.append(phys_type.base_data_type.name)
else:
data_type.append(None)
if isinstance(param, PhysicalConstantParameter):
Expand Down

0 comments on commit a008df6

Please sign in to comment.