File tree Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Expand file tree Collapse file tree 1 file changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,19 @@ def __iter__(self):
40
40
return iter (self .map )
41
41
42
42
def __getitem__ (self , key ):
43
- if isinstance (key , int ) and (0x1A00 <= key <= 0x1BFF or # By TPDO ID (512)
44
- 0x1600 <= key <= 0x17FF or # By RPDO ID (512)
45
- 0 < key <= 512 ): # By PDO Index
46
- return self .map [key ]
47
- else :
48
- for pdo_map in self .map .values ():
49
- try :
50
- return pdo_map [key ]
51
- except KeyError :
52
- # ignore if one specific PDO does not have the key and try the next one
53
- continue
43
+ if isinstance (key , int ):
44
+ if (
45
+ 0 < key <= 512 # By PDO Index
46
+ or 0x1600 <= key <= 0x17FF # By RPDO ID (512)
47
+ or 0x1A00 <= key <= 0x1BFF # By TPDO ID (512)
48
+ ):
49
+ return self .map [key ]
50
+ for pdo_map in self .map .values ():
51
+ try :
52
+ return pdo_map [key ]
53
+ except KeyError :
54
+ # ignore if one specific PDO does not have the key and try the next one
55
+ continue
54
56
raise KeyError (f"PDO: { key } was not found in any map" )
55
57
56
58
def __len__ (self ):
You can’t perform that action at this time.
0 commit comments