Fixed C416 Unnecessary list comprehension - rewrite using list().

This commit is contained in:
Salvador E. Tropea 2022-02-17 16:32:16 -03:00
parent f0c581d144
commit c8d131fe11
3 changed files with 4 additions and 4 deletions

View File

@ -1633,7 +1633,7 @@ class Schematic(object):
if exclude_power:
components = [c for c in self.components if not c.is_power]
else:
components = [c for c in self.components]
components = list(self.components)
for sch in self.sheets:
components.extend(sch.sheet.get_components(exclude_power))
components.sort(key=lambda g: g.ref)

View File

@ -75,7 +75,7 @@ DATASHEET_COLUMN_NAME = 'Datasheet'
SOURCE_BOM_COLUMN_NAME = 'Source BoM'
KIBOM_TEST_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Status',
DATASHEET_COLUMN_NAME, 'Config']
KIBOM_TEST_HEAD_TOL = [c for c in KIBOM_TEST_HEAD]
KIBOM_TEST_HEAD_TOL = list(KIBOM_TEST_HEAD)
KIBOM_TEST_HEAD_TOL.insert(-1, 'Tolerance')
KIBOM_RENAME_HEAD = [COMP_COLUMN_NAME_R, REF_COLUMN_NAME_R, 'Componente', 'Valor', 'Código Digi-Key', 'Cantidad por PCB']
CONN_HEAD = [COMP_COLUMN_NAME, 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Status',

View File

@ -617,9 +617,9 @@ class TestContext(object):
rows = []
headers = None
for child in ET.parse(self.expect_out_file(os.path.join(self.sub_dir, filename))).getroot():
rows.append([v for v in child.attrib.values()])
rows.append(list(child.attrib.values()))
if not headers:
headers = [k for k in child.attrib.keys()]
headers = list(child.attrib.keys())
return rows, headers
def load_xlsx(self, filename, sheet=1):