From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1440521-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 293D4158094 for <garchives@archives.gentoo.org>; Wed, 28 Sep 2022 23:56:21 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 51AEDE093D; Wed, 28 Sep 2022 23:56:20 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 112C2E093D for <gentoo-commits@lists.gentoo.org>; Wed, 28 Sep 2022 23:56:20 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EB84B340CAA for <gentoo-commits@lists.gentoo.org>; Wed, 28 Sep 2022 23:56:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 2856B5EE for <gentoo-commits@lists.gentoo.org>; Wed, 28 Sep 2022 23:56:17 +0000 (UTC) From: "Sam James" <sam@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org> Message-ID: <1664409368.d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8.sam@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/ X-VCS-Repository: proj/portage X-VCS-Files: lib/portage/news.py X-VCS-Directories: lib/portage/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8 X-VCS-Branch: master Date: Wed, 28 Sep 2022 23:56:17 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 34b4d55c-542d-46b2-babe-cd5632c39276 X-Archives-Hash: dcc78dca300d5981118ac55805dd5df7 commit: d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8 Author: Dima S <dimonade <AT> protonmail <DOT> com> AuthorDate: Sat Sep 24 18:01:26 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Wed Sep 28 23:56:08 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d4df27b8 portage: news: reformatted for PEP8; add docstrings; add type annotation Signed-off-by: Dima S <dimonade <AT> protonmail.com> Closes: https://github.com/gentoo/portage/pull/908 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/news.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/portage/news.py b/lib/portage/news.py index 6b2996c31..7964f74d3 100644 --- a/lib/portage/news.py +++ b/lib/portage/news.py @@ -474,20 +474,23 @@ def count_unread_news(portdb, vardb, repos=None, update=True): return news_counts -def display_news_notifications(news_counts): +def display_news_notifications(news_counts: dict): """ Display a notification for unread news items, using a dictionary mapping repos to integer counts, like that returned from count_unread_news(). + + @param news_count: mapping of repos to integer counts of unread news items + @type news_count: dict """ - newsReaderDisplay = False + news_reader_display = False for repo, count in news_counts.items(): if count > 0: - if not newsReaderDisplay: - newsReaderDisplay = True + if not news_reader_display: + news_reader_display = True print() print(colorize("WARN", " * IMPORTANT:"), end=" ") print(f"{count} news items need reading for repository '{repo}'.") - if newsReaderDisplay: + if news_reader_display: print(colorize("WARN", " *"), end=" ") print(f"Use {colorize('GOOD', 'eselect news read')} to view new items.\n")