diff --git a/kibot/bom/bom.py b/kibot/bom/bom.py index 54e96221..f8bbd0a6 100644 --- a/kibot/bom/bom.py +++ b/kibot/bom/bom.py @@ -201,10 +201,10 @@ class ComponentGroup(object): def get_count(self, project=None): if project is None: # Total components - qty = sum(map(lambda c: c.qty, self.components)) + qty = sum((c.qty for c in self.components)) else: # Only for the specified project - qty = sum(map(lambda c: c.qty if c.project == project else 0, self.components)) + qty = sum((c.qty for c in self.components if c.project == project)) return self.round_qty(qty) def get_build_count(self): @@ -213,10 +213,10 @@ class ComponentGroup(object): return 0 if len(self.cfg.aggregate) == 1: # Just one project - qty = sum(map(lambda c: c.qty, self.components))*self.cfg.number + qty = sum((c.qty for c in self.components))*self.cfg.number else: # Multiple projects, count them using the number of board for each project - qty = sum(map(lambda c: self.cfg.qtys[c.project]*c.qty, self.components)) + qty = sum((self.cfg.qtys[c.project]*c.qty for c in self.components)) return self.round_qty(qty) def get_sources(self): @@ -533,7 +533,7 @@ def do_bom(file_name, ext, comps, cfg): # Create the BoM logger.debug("Saving BOM File: "+file_name) number = cfg.number - cfg.number = sum(map(lambda prj: prj.number, cfg.aggregate)) + cfg.number = sum((prj.number for prj in cfg.aggregate)) # Pre-format the total and fitted strings cfg.total_str = smd_tht(cfg, cfg.n_total, cfg.n_total_smd, cfg.n_total_tht) cfg.fitted_str = smd_tht(cfg, cfg.n_fitted, cfg.n_fitted_smd, cfg.n_fitted_tht) diff --git a/kibot/bom/units.py b/kibot/bom/units.py index 580ea618..1314098c 100644 --- a/kibot/bom/units.py +++ b/kibot/bom/units.py @@ -231,7 +231,7 @@ def comp_match(component, ref_prefix, ref=None, relax_severity=False, stronger=F check_extra_data(result, original) result = value_from_grammar(result) if result and result.get_extra('discarded'): - discarded = " ".join(list(map(lambda x: '`'+x+'`', result.get_extra('discarded')))) + discarded = " ".join(('`'+x+'`' for x in result.get_extra('discarded'))) log_func_warn(W_BADVAL4+"Malformed value: `{}` (discarded: {}{})".format(original, discarded, where)) if not result: log_func_warn(W_BADVAL1+"Malformed value: `{}` (no match{})".format(original, where)) diff --git a/kibot/config_reader.py b/kibot/config_reader.py index b52a08d6..c28394cf 100644 --- a/kibot/config_reader.py +++ b/kibot/config_reader.py @@ -340,7 +340,7 @@ class CfgYamlReader(object): if explicit_outs: logger.warning(W_NOOUTPUTS+"No outputs found in `{}`".format(fn_rel)) else: - logger.debug('Outputs loaded from `{}`: {}'.format(fn_rel, list(map(lambda c: c.name, sel_outs)))) + logger.debug('Outputs loaded from `{}`: {}'.format(fn_rel, (c.name for c in sel_outs))) if outs is None and explicit_outs and 'outputs' not in data: logger.warning(W_NOOUTPUTS+"No outputs found in `{}`".format(fn_rel)) return sel_outs @@ -364,7 +364,7 @@ class CfgYamlReader(object): if explicit_pres: logger.warning(W_NOPREFLIGHTS+"No preflights found in `{}`".format(fn_rel)) else: - logger.debug('Preflights loaded from `{}`: {}'.format(fn_rel, list(map(lambda c: c._name, sel_pres)))) + logger.debug('Preflights loaded from `{}`: {}'.format(fn_rel, (c._name for c in sel_pres))) if pre is None and explicit_pres and 'preflight' not in data: logger.warning(W_NOPREFLIGHTS+"No preflights found in `{}`".format(fn_rel)) return sel_pres diff --git a/kibot/gs.py b/kibot/gs.py index a161add5..40cfd0f8 100644 --- a/kibot/gs.py +++ b/kibot/gs.py @@ -625,7 +625,7 @@ class GS(object): For tuples we assume the result is SVG coordinates, for 1 value a scale """ if GS.ki5: if isinstance(values, tuple): - return tuple(map(lambda x: int(round(x*KICAD5_SVG_SCALE)), values)) + return (int(round(x*KICAD5_SVG_SCALE)) for x in values) return values*KICAD5_SVG_SCALE if GS.ki7: if isinstance(values, tuple): @@ -634,7 +634,7 @@ class GS(object): # KiCad 6 mult = 10.0 ** (svg_precision - 6) if isinstance(values, tuple): - return tuple(map(lambda x: int(round(x*mult)), values)) + return (int(round(x*mult)) for x in values) return values*mult @staticmethod