All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chris Laplante" <chris.laplante@agilent.com>
To: <bitbake-devel@lists.openembedded.org>
Cc: Chris Laplante <chris.laplante@agilent.com>
Subject: [PATCH v3 06/10] main: rename list_extension_modules => load_extension_modules to clarify its function
Date: Sun, 8 Nov 2020 17:10:55 -0500	[thread overview]
Message-ID: <20201108221059.16854-7-chris.laplante@agilent.com> (raw)
In-Reply-To: <20201108221059.16854-1-chris.laplante@agilent.com>

Also clearly document in docstring that it is the modules themselves
that are returned.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/main.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/bb/main.py b/lib/bb/main.py
index e211768f..ccb844bb 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -40,9 +40,9 @@ class BBMainFatal(bb.BBHandledException):
     pass
 
 
-def list_extension_modules(pkg, checkattr):
+def load_extension_modules(pkg, checkattr):
     """
-    Lists extension modules in a specific Python package
+    Loads extension modules in a specific Python namespace package.
     (e.g. UIs, servers). NOTE: Calling this function will import all of the
     submodules of the specified module in order to check for the specified
     attribute; this can have unusual side-effects. As a result, this should
@@ -51,6 +51,7 @@ def list_extension_modules(pkg, checkattr):
         pkg: previously imported Python package to list
         checkattr: attribute to look for in module to determine if it's valid
             as the type of extension you are looking for
+    Returns: list of modules (imported via importlib)
     """
     import pkgutil
     import importlib
@@ -101,7 +102,7 @@ class LazyUiChoices:
 
     def _lazy_load_modules(self):
         if not self._modules:
-            self._modules = {module.__name__.split(".")[-1]: module for module in list_extension_modules(bb.ui, "main")}
+            self._modules = {module.__name__.split(".")[-1]: module for module in load_extension_modules(bb.ui, "main")}
 
     def __iter__(self):
         self._lazy_load_modules()
-- 
2.17.1


  parent reply	other threads:[~2020-11-08 22:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08 22:10 [PATCH v3 00/10] optparse => argparse Chris Laplante
2020-11-08 22:10 ` [PATCH v3 01/10] cookerdata: tweak to avoid mutable default argument Chris Laplante
2020-11-08 22:10 ` [PATCH v3 02/10] tests/arg_parser: add stub for testing arg parsing Chris Laplante
2020-11-08 22:10 ` [PATCH v3 03/10] tests/arg_parser: add test for 'bitbake -S none world' Chris Laplante
2020-11-08 22:10 ` [PATCH v3 04/10] main: migrate from optparse to argparse Chris Laplante
2020-11-08 22:10 ` [PATCH v3 05/10] main: group --help options to make them easier to read Chris Laplante
2020-11-08 22:10 ` Chris Laplante [this message]
2020-11-08 22:10 ` [PATCH v3 07/10] tests/arg_parser: add test for lazy loading of bb.ui modules Chris Laplante
2020-11-08 22:10 ` [PATCH v3 08/10] main: fix parsing of intermixed arguments Chris Laplante
2020-11-08 22:10 ` [PATCH v3 09/10] tinfoil: use knotty module itself as default 'ui' arg to keep up with changes in setup_bitbake Chris Laplante
2020-11-08 22:10 ` [PATCH v3 10/10] tests/arg_parser: add test for default TinfoilConfigParameters 'ui' Chris Laplante
2020-11-10 21:33 ` [bitbake-devel] [PATCH v3 00/10] optparse => argparse Richard Purdie
2020-11-10 21:36   ` Chris Laplante
2020-11-10 21:38 ` Richard Purdie
2020-11-10 21:40   ` Chris Laplante
2020-11-18 16:37   ` Chris Laplante
2020-11-18 16:44     ` Richard Purdie
2020-11-18 17:07       ` Chris Laplante
2020-11-18 17:24         ` Richard Purdie
2020-11-18 21:01           ` Chris Laplante
2020-11-20 11:17             ` Richard Purdie
     [not found]       ` <1648A9226B93C86E.28066@lists.openembedded.org>
2020-11-18 17:08         ` Chris Laplante

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=20201108221059.16854-7-chris.laplante@agilent.com \
    --to=chris.laplante@agilent.com \
    --cc=bitbake-devel@lists.openembedded.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.