public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/util/, lib/_emerge/
@ 2023-06-06  6:52 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-06-06  6:52 UTC (permalink / raw
  To: gentoo-commits

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().


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-06  6:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  6:52 [gentoo-commits] proj/portage:master commit in: lib/portage/util/, lib/_emerge/ Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox