Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the *segment_info() functions #365

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions odxtools/parameterinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,36 +34,36 @@

def _get_linear_segment_info(segment: LinearSegment) -> str:
ll = segment.physical_lower_limit
ul = segment.physical_upper_limit
if ll is None or ll.interval_type == IntervalType.INFINITE:
ll_str = "(-inf"
else:
ll_delim = '(' if ll.interval_type == IntervalType.OPEN else '['
ll_str = f"{ll_delim}{ll._value!r}"

if ul is None or ul.interval_type == IntervalType.INFINITE:
ul_str = "inf)"
else:
ul_delim = ')' if ul.interval_type == IntervalType.OPEN else ']'
ul_str = f"{ul._value!r}{ul_delim}"
ul = segment.physical_upper_limit
if ul is None or ul.interval_type == IntervalType.INFINITE:
ul_str = "inf)"
else:
ul_delim = ')' if ul.interval_type == IntervalType.OPEN else ']'
ul_str = f"{ul._value!r}{ul_delim}"

return f"{ll_str}, {ul_str}"


def _get_rat_func_segment_info(segment: RatFuncSegment) -> str:
ll = segment.lower_limit
ul = segment.upper_limit
if ll is None or ll.interval_type == IntervalType.INFINITE:
ll_str = "(-inf"
else:
ll_delim = '(' if ll.interval_type == IntervalType.OPEN else '['
ll_str = f"{ll_delim}{ll._value!r}"

if ul is None or ul.interval_type == IntervalType.INFINITE:
ul_str = "inf)"
else:
ul_delim = ')' if ul.interval_type == IntervalType.OPEN else ']'
ul_str = f"{ul._value!r}{ul_delim}"
ul = segment.upper_limit
if ul is None or ul.interval_type == IntervalType.INFINITE:
ul_str = "inf)"
else:
ul_delim = ')' if ul.interval_type == IntervalType.OPEN else ']'
ul_str = f"{ul._value!r}{ul_delim}"

return f"{ll_str}, {ul_str}"

Expand Down
Loading