pyllint: enable consider-user-enumerate
This caught a couple of cases of us doing: ```python for i in range(len(x)): v = x[i] ``` which are places to use enumerate instead. It also caught a couple of cases of: ```python assert len(x) == len(y) for i in range(len(x)): xv = x[i] yv = y[i] ``` Which should instead be using zip() ```python for xv, yv in zip(x, y): ... ```
This commit is contained in:
parent
4d7031437c
commit
b60bd0e299
|
@ -13,6 +13,7 @@ enable=
|
|||
bare-except,
|
||||
compare-to-zero,
|
||||
consider-iterating-dictionary,
|
||||
consider-using-enumerate,
|
||||
dangerous-default-value,
|
||||
deprecated-lambda,
|
||||
len-as-condition,
|
||||
|
|
|
@ -2193,8 +2193,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
|
|||
infilelist = genlist.get_inputs()
|
||||
outfilelist = genlist.get_outputs()
|
||||
extra_dependencies = self.get_custom_target_depend_files(genlist)
|
||||
for i in range(len(infilelist)):
|
||||
curfile = infilelist[i]
|
||||
for i, curfile in enumerate(infilelist):
|
||||
if len(generator.outputs) == 1:
|
||||
sole_output = os.path.join(self.get_target_private_dir(target), outfilelist[i])
|
||||
else:
|
||||
|
|
|
@ -122,12 +122,11 @@ class Vs2010Backend(backends.Backend):
|
|||
source_dir = os.path.join(down, self.build_to_src, genlist.subdir)
|
||||
exe_arr = self.build_target_to_cmd_array(exe)
|
||||
idgroup = ET.SubElement(parent_node, 'ItemGroup')
|
||||
for i in range(len(infilelist)):
|
||||
for i, curfile in enumerate(infilelist):
|
||||
if len(infilelist) == len(outfilelist):
|
||||
sole_output = os.path.join(target_private_dir, outfilelist[i])
|
||||
else:
|
||||
sole_output = ''
|
||||
curfile = infilelist[i]
|
||||
infilename = os.path.join(down, curfile.rel_to_builddir(self.build_to_src))
|
||||
deps = self.get_custom_target_depend_files(genlist, True)
|
||||
base_args = generator.get_arglist(infilename)
|
||||
|
|
|
@ -678,9 +678,7 @@ class XCodeBackend(backends.Backend):
|
|||
file_ids = self.generator_buildfile_ids[(tname, generator_id)]
|
||||
ref_ids = self.generator_fileref_ids[(tname, generator_id)]
|
||||
assert len(ref_ids) == len(file_ids)
|
||||
for i in range(len(file_ids)):
|
||||
file_o = file_ids[i]
|
||||
ref_id = ref_ids[i]
|
||||
for file_o, ref_id in zip(file_ids, ref_ids):
|
||||
odict = PbxDict()
|
||||
objects_dict.add_item(file_o, odict)
|
||||
odict.add_item('isa', 'PBXBuildFile')
|
||||
|
@ -758,9 +756,7 @@ class XCodeBackend(backends.Backend):
|
|||
outputs = self.generator_outputs[(tname, generator_id)]
|
||||
ref_ids = self.generator_fileref_ids[tname, generator_id]
|
||||
assert len(ref_ids) == len(outputs)
|
||||
for i in range(len(outputs)):
|
||||
o = outputs[i]
|
||||
ref_id = ref_ids[i]
|
||||
for o, ref_id in zip(outputs, ref_ids):
|
||||
odict = PbxDict()
|
||||
name = os.path.basename(o)
|
||||
objects_dict.add_item(ref_id, odict, o)
|
||||
|
|
Loading…
Reference in New Issue