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")
