Fix: "import" issue for Python 2/3 compatible code

use proper absolute path to import modules

remove ignore case 'H301: one import per line'

Story: 2002909
Task:  24886

Change-Id: I1d72e68ead64492ff0c74f8c1bf1b460b573bc1e
Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
Sun Austin 2018-12-18 13:32:08 +08:00
parent 4d9e712c78
commit 79c3a1b255
9 changed files with 35 additions and 19 deletions

View File

@ -4,8 +4,8 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
import exception from ceph_manager import exception
from i18n import _LI from ceph_manager.i18n import _LI
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from oslo_log import log as logging from oslo_log import log as logging

View File

@ -4,7 +4,7 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from i18n import _ from ceph_manager.i18n import _
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from sysinv.common import constants as sysinv_constants from sysinv.common import constants as sysinv_constants

View File

@ -5,7 +5,8 @@
# #
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from i18n import _, _LW from ceph_manager.i18n import _
from ceph_manager.i18n import _LW
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from oslo_log import log as logging from oslo_log import log as logging

View File

@ -14,10 +14,13 @@ from fm_api import constants as fm_constants
from oslo_log import log as logging from oslo_log import log as logging
# noinspection PyProtectedMember # noinspection PyProtectedMember
from i18n import _, _LI, _LW, _LE from ceph_manager.i18n import _
from ceph_manager.i18n import _LI
from ceph_manager.i18n import _LW
from ceph_manager.i18n import _LE
import constants from ceph_manager import constants
import exception from ceph_manager import exception
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -30,11 +30,12 @@ from oslo_service import loopingcall
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from cephclient import wrapper from cephclient import wrapper
from monitor import Monitor from ceph_manager.monitor import Monitor
import exception from ceph_manager import exception
import constants from ceph_manager import constants
from i18n import _LI, _LW from ceph_manager.i18n import _LI
from ceph_manager.i18n import _LW
from retrying import retry from retrying import retry
eventlet.monkey_patch(all=True) eventlet.monkey_patch(all=True)

View File

@ -8,6 +8,7 @@ SPDX-License-Identifier: Apache-2.0
################### ###################
# IMPORTS # IMPORTS
################### ###################
from __future__ import absolute_import
import logging import logging
import logging.handlers import logging.handlers
import time import time
@ -19,7 +20,7 @@ import sys
from daemon import runner from daemon import runner
import prepostrotate from logmgmt import prepostrotate
################### ###################
# CONSTANTS # CONSTANTS

View File

@ -16,8 +16,10 @@ import logging
from six.moves import configparser from six.moves import configparser
import itertools import itertools
import six import six
from multiprocessing import Process, cpu_count from multiprocessing import Process
from subprocess import Popen, PIPE from multiprocessing import cpu_count
from subprocess import Popen
from subprocess import PIPE
from collections import OrderedDict from collections import OrderedDict
from six.moves import input from six.moves import input

View File

@ -74,7 +74,6 @@ commands =
# H233: Python 3.x incompatible use of print operator # H233: Python 3.x incompatible use of print operator
# H237: module exception is removed in Python 3 # H237: module exception is removed in Python 3
# H238: old style class declaration, use new style # H238: old style class declaration, use new style
# H301: one import per line
# H306: imports not in alphabetical order # H306: imports not in alphabetical order
# H401: docstring should not start with a space # H401: docstring should not start with a space
# H404: multi line docstring should start without a leading new line # H404: multi line docstring should start without a leading new line
@ -94,7 +93,7 @@ commands =
# F841 local variable '_alarm_state' is assigned to but never used # F841 local variable '_alarm_state' is assigned to but never used
ignore = E101,E121,E123,E124,E125,E126,E127,E128,E201,E202,E203,E211,E221,E222,E225,E226,E231,E251,E261,E265,E266, ignore = E101,E121,E123,E124,E125,E126,E127,E128,E201,E202,E203,E211,E221,E222,E225,E226,E231,E251,E261,E265,E266,
E302,E303,E305,E402,E501,E711,E722,E741,E999, E302,E303,E305,E402,E501,E711,E722,E741,E999,
H101,H102,H104,H201,H238,H233,H237,H301,H306,H401,H404,H405, H101,H102,H104,H201,H238,H233,H237,H306,H401,H404,H405,
W191,W291,W391,W503, W191,W291,W391,W503,
B001,B007,B301,B306, B001,B007,B301,B306,
F401,F841 F401,F841

View File

@ -3,14 +3,23 @@
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
from ctypes import cdll,util,c_bool,c_int,c_char_p,pointer,create_string_buffer from ctypes import cdll
from ctypes import util
from ctypes import c_bool
from ctypes import c_int
from ctypes import c_char_p
from ctypes import pointer
from ctypes import create_string_buffer
import logging import logging
import os import os
from platform_util.license import constants,exception from platform_util.license import constants
from platform_util.license import exception
import re import re
import sys import sys
from sysinv.common import constants as sysinv_constants from sysinv.common import constants as sysinv_constants
from tsconfig.tsconfig import system_type,system_mode, SW_VERSION from tsconfig.tsconfig import system_type
from tsconfig.tsconfig import system_mode
from tsconfig.tsconfig import SW_VERSION
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)