diff options
author | Dima S <dimonade@protonmail.com> | 2022-09-24 20:01:26 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-09-29 00:56:08 +0100 |
commit | d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8 (patch) | |
tree | db0d909b4024ec7055361688702268b255d5f743 | |
parent | cnf: sets: convert @golang-rebuild into VariableSet (diff) | |
download | portage-d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8.tar.gz portage-d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8.tar.bz2 portage-d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8.zip |
portage: news: reformatted for PEP8; add docstrings; add type annotation
Signed-off-by: Dima S <dimonade@protonmail.com>
Closes: https://github.com/gentoo/portage/pull/908
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | lib/portage/news.py | 13 |
1 files 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") |