c4deszes / ldfparser

LIN Description File parser written in Python
https://c4deszes.github.io/ldfparser/
MIT License
64 stars 26 forks source link

Get LinFrame from LinSignal #93

Closed c4deszes closed 2 years ago

c4deszes commented 2 years ago

Discussed in https://github.com/c4deszes/ldfparser/discussions/92

Originally posted by **C47D** February 25, 2022 Hi, I'm trying to get the frame that 'contains' a given signal by using the signal name, something like this ```python def get_frame_by_signal(unconditional_frames, signal_name: str): for frame in unconditional_frames: if frame._get_signal(signal_name) is not None: return frame return None ``` It seems to work, but I would like to know if there's a cleaner way since I'm not used to python. Regards