Nir Soffer has posted comments on this change.

Change subject: Using pkgutil instead of redundant private funcs in configurator
......................................................................


Patch Set 27:

(1 comment)

https://gerrit.ovirt.org/#/c/53214/27/lib/vdsm/module_loader.py
File lib/vdsm/module_loader.py:

Line 26: def load_modules(pkg_name):
Line 27:     modules = {}
Line 28:     for _, module_name, _ in 
pkgutil.iter_modules([pkg_name.__path__[0]]):
Line 29:         modules[module_name] = importlib.import_module(
Line 30:             '{}.{}'.format(pkg_name.__name__, module_name))
Please avoid long lines doing too much, it make the code harder to read.

Use:

    package_path = pkg_name.__path__[0]
    for _, module_name, _ in pkgutil.iter_modules([package_path]):
        full_name = '{}.{}'.format(pkg_name.__name__, module_name)
        modules[module_name] = importlib.import_module(full_name)

The code should explain itself and be joy to read.


-- 
To view, visit https://gerrit.ovirt.org/53214
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Iec710e795aeaf5b611f6dbe4f8ea535c8be5fa14
Gerrit-PatchSet: 27
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Yaniv Bronhaim <ybron...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Edward Haas <edwa...@redhat.com>
Gerrit-Reviewer: Irit Goihman <igoih...@redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczew...@gmail.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybron...@redhat.com>
Gerrit-Reviewer: gerrit-hooks <automat...@ovirt.org>
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to