def _show_summary(self, packages: Dict[str, List[str]]) -> None: to_add = [self.candidates[key] for key in packages["add"]] to_update = [(self.working_set[key], self.candidates[key]) for key in packages["update"]] to_remove = [self.working_set[key] for key in packages["remove"]] lines = [] if to_add: lines.append(termui.bold("Packages to add:")) for can in to_add: lines.append(f" - {can.format()}") if to_update: lines.append(termui.bold("Packages to update:")) for prev, cur in to_update: lines.append( f" - {termui.green(cur.name, bold=True)} " f"{termui.yellow(prev.version)} -> {termui.yellow(cur.version)}" ) if to_remove: lines.append(termui.bold("Packages to remove:")) for dist in to_remove: lines.append( f" - {termui.green(dist.metadata['Name'], bold=True)} " f"{termui.yellow(dist.version)}") if lines: self.ui.echo("\n".join(lines))
def _show_headline(self, packages: Dict[str, List[str]]) -> None: add, update, remove = packages["add"], packages["update"], packages[ "remove"] if not any((add, update, remove)): self.ui.echo("All packages are synced to date, nothing to do.\n") return results = [termui.bold("Synchronizing working set with lock file:")] results.extend([ f"{termui.green(str(len(add)))} to add,", f"{termui.yellow(str(len(update)))} to update,", f"{termui.red(str(len(remove)))} to remove", ]) self.ui.echo(" ".join(results) + "\n")