-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
I noticed the following deprecation warning when using odxtools with Python 3.12:
odxtools/specialdatagroup.py:25: DeprecationWarning: Testing an element's truth value will always return True in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if caption_elem := et_element.find("SDG-CAPTION"):
which is caused by the following line:
odxtools/odxtools/specialdatagroup.py
Line 25 in a602a79
| if caption_elem := et_element.find("SDG-CAPTION"): |
This can be fixed as follows:
- if caption_elem := et_element.find("SDG-CAPTION"):
+ if (caption_elem := et_element.find("SDG-CAPTION")) is not None:There are at least two more similar issues:
| for elem in et_element.find("OUT-PARAM-IF-REFS") or []: |
and
| for elem in et_element.find("IN-PARAM-IF-REFS") or []: |
which can be fixed similarly, e.g.:
- for elem in et_element.find("IN-PARAM-IF-REFS") or []:
+ for elem in [] if (in_elems := et_element.find("IN-PARAM-IF-REFS")) is None else in_elems:Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels