@@ -110,7 +110,7 @@ def __get_resolution_order(self, target_name, order, level=0):
110
110
parent's parent at level 2 and so on)
111
111
"""
112
112
# the resolution order can't contain duplicate target names
113
- if not target_name in [l [0 ] for l in order ]:
113
+ if target_name not in [l [0 ] for l in order ]:
114
114
order .append ((target_name , level ))
115
115
parents = self .get_json_target_data ()[target_name ].get ("inherits" , [])
116
116
for par in parents :
@@ -149,17 +149,17 @@ def __getattr_cumulative(self, attrname):
149
149
break
150
150
else :
151
151
raise AttributeError ("Attribute '%s' not found in target '%s'"
152
- % (attrname , self .name ))
152
+ % (attrname , self .name ))
153
153
# Get the starting value of the attribute
154
154
starting_value = (tdata [self .resolution_order [def_idx ][0 ]][attrname ]
155
- or [])[:]
155
+ or [])[:]
156
156
# Traverse the resolution list in high inheritance to low
157
157
# inheritance level, left to right order to figure out all the
158
158
# other classes that change the definition by adding or removing
159
159
# elements
160
160
for idx in xrange (self .resolution_order [def_idx ][1 ] - 1 , - 1 , - 1 ):
161
161
same_level_targets = [tar [0 ] for tar in self .resolution_order
162
- if tar [1 ] == idx ]
162
+ if tar [1 ] == idx ]
163
163
for tar in same_level_targets :
164
164
data = tdata [tar ]
165
165
# Do we have anything to add ?
@@ -186,10 +186,10 @@ def __getattr_cumulative(self, attrname):
186
186
else :
187
187
name_def_map [crtv ] = crtv
188
188
for element in data [attrname + "_remove" ]:
189
- if not element in name_def_map :
189
+ if element not in name_def_map :
190
190
raise ValueError (
191
191
("Unable to remove '%s' in '%s.%s' since "
192
- % (element , self .name , attrname )) +
192
+ % (element , self .name , attrname )) +
193
193
"it doesn't exist" )
194
194
starting_value .remove (name_def_map [element ])
195
195
return starting_value
@@ -277,7 +277,7 @@ def get_labels(self):
277
277
labels = [self .name ] + CORE_LABELS [self .core ] + self .extra_labels
278
278
# Automatically define UVISOR_UNSUPPORTED if the target doesn't
279
279
# specifically define UVISOR_SUPPORTED
280
- if not "UVISOR_SUPPORTED" in labels :
280
+ if "UVISOR_SUPPORTED" not in labels :
281
281
labels .append ("UVISOR_UNSUPPORTED" )
282
282
return labels
283
283
@@ -357,7 +357,8 @@ def binary_hook(t_self, resources, elf, binf):
357
357
outbin .write (data )
358
358
outbin .write ('\xFF ' * (512 * 1024 - len (data )))
359
359
partf .close ()
360
- # Read and append the second part (external flash) in chunks of fixed size
360
+ # Read and append the second part (external flash) in chunks of fixed
361
+ # size
361
362
chunksize = 128 * 1024
362
363
partf = open (os .path .join (binf , "ER_IROM2" ), "rb" )
363
364
while True :
@@ -389,7 +390,7 @@ def binary_hook(t_self, resources, elf, binf):
389
390
class MTSCode (object ):
390
391
"""Generic MTS code"""
391
392
@staticmethod
392
- def _combine_bins_helper (target_name , t_self , resources , elf , binf ):
393
+ def _combine_bins_helper (target_name , binf ):
393
394
"""combine bins with the bootloader for a particular target"""
394
395
loader = os .path .join (TOOLS_BOOTLOADERS , target_name , "bootloader.bin" )
395
396
target = binf + ".tmp"
@@ -418,19 +419,17 @@ def _combine_bins_helper(target_name, t_self, resources, elf, binf):
418
419
@staticmethod
419
420
def combine_bins_mts_dot (t_self , resources , elf , binf ):
420
421
"""A hook for the MTS MDOT"""
421
- MTSCode ._combine_bins_helper ("MTS_MDOT_F411RE" , t_self , resources , elf ,
422
- binf )
422
+ MTSCode ._combine_bins_helper ("MTS_MDOT_F411RE" , binf )
423
423
424
424
@staticmethod
425
425
def combine_bins_mts_dragonfly (t_self , resources , elf , binf ):
426
426
"""A hoof for the MTS Dragonfly"""
427
- MTSCode ._combine_bins_helper ("MTS_DRAGONFLY_F411RE" , t_self , resources ,
428
- elf , binf )
427
+ MTSCode ._combine_bins_helper ("MTS_DRAGONFLY_F411RE" , binf )
429
428
430
429
class MCU_NRF51Code (object ):
431
430
"""NRF51 Hooks"""
432
431
@staticmethod
433
- def binary_hook (t_self , resources , elf , binf ):
432
+ def binary_hook (t_self , resources , _ , binf ):
434
433
"""Hook that merges the soft device with the bin file"""
435
434
# Scan to find the actual paths of soft device
436
435
sdf = None
@@ -519,9 +518,9 @@ def set_targets_json_location(location=None):
519
518
# re-initialization does not create new variables, it keeps the old ones
520
519
# instead. This ensures compatibility with code that does
521
520
# "from tools.targets import TARGET_NAMES"
522
- TARGETS [:] = [Target .get_target (name ) for name , value
521
+ TARGETS [:] = [Target .get_target (target ) for target , obj
523
522
in Target .get_json_target_data ().items ()
524
- if value .get ("public" , True )]
523
+ if obj .get ("public" , True )]
525
524
TARGET_MAP .clear ()
526
525
TARGET_MAP .update (dict ([(target .name , target ) for target in TARGETS ]))
527
526
TARGET_NAMES [:] = TARGET_MAP .keys ()
0 commit comments