Project

General

Profile

Support #22437

Use absolute imports: from future import absolute_import to maintain consistency

Added by Lorena Lobato Pardavila 3 months ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Category:
-
Target version:
Start date:
04/23/2019
Due date:
% Done:

0%

Estimated time:
Stakeholders:
Duration:

Description

Checking pylint errors from one of my branches (it was not updated with master), I saw the same import in different files:

llobato@mac-126950:~/test_20215_2/glideinwms$ grep -R "glideinwms.factory.glideFactorySelectionAlgorithms" ./*
./creation/lib/factoryXmlConfig.py:*import glideinwms.factory.glideFactorySelectionAlgorithms*
./creation/lib/factoryXmlConfig.py:            if not(getattr(glideinwms.factory.glideFactorySelectionAlgorithms, 'selectionAlgo' + algo_name, None)):
./factory/glideFactoryLib.py:*import glideinwms.factory.glideFactorySelectionAlgorithms*
./factory/glideFactoryLib.py:            selection_function = getattr(glideinwms.factory.glideFactorySelectionAlgorithms, 'selectionAlgo' + algo_name)

For consistency with the rest of the code, I propose to use absolute imports: from future import absolute_import to maintain consistency:

from glideinwms.factory import glideFactorySelectionAlgorithms

and not:

import glideinwms.factory.glideFactorySelectionAlgorithms

And therefore, adapt the input parameter from getattr function (otherwise it will give a pylint error)

History

#1 Updated by Lorena Lobato Pardavila 3 months ago

  • Assignee set to Marco Mascheroni

#2 Updated by Marco Mascheroni 2 months ago

  • Target version changed from v3_5 to v3_5_1


Also available in: Atom PDF