diff --git a/src/canmatrix/formats/dbc.py b/src/canmatrix/formats/dbc.py index 1f023a5f..8aa4b58a 100644 --- a/src/canmatrix/formats/dbc.py +++ b/src/canmatrix/formats/dbc.py @@ -860,7 +860,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None temp.group(2)).add_attribute( temp.group(1), temp.group(3)) - elif decoded.find('"BusType"') != -1: + elif '"BusType"' in decoded: regexp = re.compile(r"^BA_ +\"BusType\" +\"(.+?)\" *; *") temp = regexp.match(decoded) if temp: diff --git a/src/canmatrix/formats/fibex.py b/src/canmatrix/formats/fibex.py index b67e867f..b703d04f 100644 --- a/src/canmatrix/formats/fibex.py +++ b/src/canmatrix/formats/fibex.py @@ -467,8 +467,7 @@ def dump(db, f, **options): create_sub_element_fx(cluster, "SPEED", "500") create_sub_element_fx(cluster, "IS-HIGH-LOW-BIT-ORDER", "true") create_sub_element_fx(cluster, "BIT-COUNTING-POLICY", "MONOTONE") - attribute = db.attributes["BusType"] - if attribute is not None and attribute == "CAN FD": + if 'BusType' in db.attributes and db.attributes['BusType'] == "CAN FD": protocol = create_sub_element_fx(cluster, "PROTOCOL", "CAN-FD") create_sub_element_fx(cluster, "CAN-FD-SPEED", "2000000") else: