Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/
Date: Wed, 28 Sep 2022 23:56:21
Message-Id: 1664409368.d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8.sam@gentoo
1 commit: d4df27b8897e7c5bb508d8a2be3f3c2cb82628e8
2 Author: Dima S <dimonade <AT> protonmail <DOT> com>
3 AuthorDate: Sat Sep 24 18:01:26 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 28 23:56:08 2022 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d4df27b8
7
8 portage: news: reformatted for PEP8; add docstrings; add type annotation
9
10 Signed-off-by: Dima S <dimonade <AT> protonmail.com>
11 Closes: https://github.com/gentoo/portage/pull/908
12 Signed-off-by: Sam James <sam <AT> gentoo.org>
13
14 lib/portage/news.py | 13 ++++++++-----
15 1 file changed, 8 insertions(+), 5 deletions(-)
16
17 diff --git a/lib/portage/news.py b/lib/portage/news.py
18 index 6b2996c31..7964f74d3 100644
19 --- a/lib/portage/news.py
20 +++ b/lib/portage/news.py
21 @@ -474,20 +474,23 @@ def count_unread_news(portdb, vardb, repos=None, update=True):
22 return news_counts
23
24
25 -def display_news_notifications(news_counts):
26 +def display_news_notifications(news_counts: dict):
27 """
28 Display a notification for unread news items, using a dictionary mapping
29 repos to integer counts, like that returned from count_unread_news().
30 +
31 + @param news_count: mapping of repos to integer counts of unread news items
32 + @type news_count: dict
33 """
34 - newsReaderDisplay = False
35 + news_reader_display = False
36 for repo, count in news_counts.items():
37 if count > 0:
38 - if not newsReaderDisplay:
39 - newsReaderDisplay = True
40 + if not news_reader_display:
41 + news_reader_display = True
42 print()
43 print(colorize("WARN", " * IMPORTANT:"), end=" ")
44 print(f"{count} news items need reading for repository '{repo}'.")
45
46 - if newsReaderDisplay:
47 + if news_reader_display:
48 print(colorize("WARN", " *"), end=" ")
49 print(f"Use {colorize('GOOD', 'eselect news read')} to view new items.\n")