From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/util/, lib/_emerge/
Date: Tue, 6 Jun 2023 06:52:42 +0000 (UTC) [thread overview]
Message-ID: <1686034360.1ed0fd5f7c76f8c099a7f5978f1745e029e5e489.sam@gentoo> (raw)
commit: 1ed0fd5f7c76f8c099a7f5978f1745e029e5e489
Author: Berin Aniesh <berinaniesh <AT> gmail <DOT> com>
AuthorDate: Tue Jun 6 05:54:33 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 6 06:52:40 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ed0fd5f
portage.util: Fix types and add add more details to docstring
Signed-off-by: Berin Aniesh <berinaniesh <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
lib/_emerge/main.py | 7 ++++---
lib/portage/util/__init__.py | 17 ++++++++++++-----
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index ec8d21b96..e471ac413 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -21,6 +21,7 @@ portage.proxy.lazyimport.lazyimport(
from portage import os
from portage.sync import _SUBMODULE_PATH_MAP
+from typing import Optional, List
options = [
"--alphabetical",
@@ -1161,12 +1162,12 @@ def profile_check(trees, myaction):
return os.EX_OK
-def emerge_main(args=None):
+def emerge_main(args: Optional[List[str]] = None):
"""
Entry point of emerge
- Processes command line arguments and decides what the current run of emerge
- should by creating `emerge_config`
+ Processes command line arguments (default: sys.argv[1:]) and decides
+ what the current run of emerge should by creating `emerge_config`
"""
if args is None:
args = sys.argv[1:]
diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
index e446a54f0..f0115aea3 100644
--- a/lib/portage/util/__init__.py
+++ b/lib/portage/util/__init__.py
@@ -72,7 +72,7 @@ import string
import sys
import traceback
import glob
-from typing import Optional
+from typing import Optional, TextIO
import portage
@@ -97,8 +97,15 @@ def initialize_logger(level=logging.WARNING) -> None:
logging.basicConfig(level=level, format="[%(levelname)-4s] %(message)s")
-def writemsg(mystr: str, noiselevel: int = 0, fd=None) -> None:
- """Prints out warning and debug messages based on the noiselimit setting"""
+def writemsg(mystr: str, noiselevel: int = 0, fd: Optional[TextIO] = None) -> None:
+ """
+ Prints out warning and debug messages based on the noiselimit setting
+
+ Takes three arguments
+ 1. mystr: The message to write
+ 2. noiselevel: The noiselevel of the message
+ 3. fd: file descriptor - where to write the message to
+ """
global noiselimit
if fd is None:
fd = sys.stderr
@@ -126,8 +133,8 @@ def writemsg_stdout(mystr: str, noiselevel: int = 0) -> None:
def writemsg_level(msg: str, level: int = 0, noiselevel: int = 0):
"""
Show a message for the given level as defined by the logging module
- (default is 0).
-
+ (default is 0).
+
When level >= logging.WARNING then the message is
sent to stderr, otherwise it is sent to stdout. The noiselevel is
passed directly to writemsg().
reply other threads:[~2023-06-06 6:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1686034360.1ed0fd5f7c76f8c099a7f5978f1745e029e5e489.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox