Fix for module level import not at top of file
Change-Id: I1994b58a027cdac3bf4084b77db61bc646aaaba6
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/code_update_utils.py b/lib/code_update_utils.py
index e8ee562..5d69db6 100644
--- a/lib/code_update_utils.py
+++ b/lib/code_update_utils.py
@@ -4,24 +4,24 @@
This module provides utilities for code updates.
"""
+from robot.libraries.BuiltIn import BuiltIn
+
+import bmc_ssh_utils as bsu
+import gen_robot_keyword as keyword
+import gen_print as gp
+import variables as var
+
import os
import re
import sys
import tarfile
import time
import collections
-from robot.libraries.BuiltIn import BuiltIn
robot_pgm_dir_path = os.path.dirname(__file__) + os.sep
repo_data_path = re.sub('/lib', '/data', robot_pgm_dir_path)
sys.path.append(repo_data_path)
-import bmc_ssh_utils as bsu
-import gen_robot_keyword as keyword
-import gen_print as gp
-import variables as var
-from robot.libraries.BuiltIn import BuiltIn
-
def get_bmc_firmware(image_type, sw_dict):
r"""
diff --git a/lib/dump_utils.py b/lib/dump_utils.py
index d0b0108..7c65df9 100755
--- a/lib/dump_utils.py
+++ b/lib/dump_utils.py
@@ -10,14 +10,16 @@
import bmc_ssh_utils as bsu
import var_funcs as vf
import os
-from robot.libraries.BuiltIn import BuiltIn
import sys
import os
import imp
+import variables as var
+
+from robot.libraries.BuiltIn import BuiltIn
+
base_path = os.path.dirname(os.path.dirname(
imp.find_module("gen_robot_print")[1])) + os.sep
sys.path.append(base_path + "data/")
-import variables as var
def get_dump_dict(quiet=None):
diff --git a/lib/ffdc_cli_robot_script.py b/lib/ffdc_cli_robot_script.py
index 013e4ab..eb2cb2e 100644
--- a/lib/ffdc_cli_robot_script.py
+++ b/lib/ffdc_cli_robot_script.py
@@ -4,12 +4,13 @@
import sys
-sys.path.append(__file__.split(__file__.split("/")[-1])[0] + "../ffdc")
from ffdc_collector import ffdc_collector
from ssh_utility import SSHRemoteclient
from robot.libraries.BuiltIn import BuiltIn as robotBuildIn
+sys.path.append(__file__.split(__file__.split("/")[-1])[0] + "../ffdc")
+
# (Sub) String constants used for input dictionary key search
HOST = "HOST"
USER = "USERNAME"
diff --git a/lib/gen_robot_ssh.py b/lib/gen_robot_ssh.py
index ab68415..b0cd049 100755
--- a/lib/gen_robot_ssh.py
+++ b/lib/gen_robot_ssh.py
@@ -16,10 +16,13 @@
import gen_print as gp
import func_timer as ft
-func_timer = ft.func_timer_class()
+
from robot.libraries.BuiltIn import BuiltIn
from SSHLibrary import SSHLibrary
+
+func_timer = ft.func_timer_class()
+
sshlib = SSHLibrary()
diff --git a/lib/ipmi_utils.py b/lib/ipmi_utils.py
index f8cc9be..b2a1b2b 100644
--- a/lib/ipmi_utils.py
+++ b/lib/ipmi_utils.py
@@ -14,9 +14,10 @@
import var_funcs as vf
import ipmi_client as ic
import tempfile
-gru.my_import_resource("ipmi_client.robot")
-from robot.libraries.BuiltIn import BuiltIn
import json
+from robot.libraries.BuiltIn import BuiltIn
+
+gru.my_import_resource("ipmi_client.robot")
def get_sol_info():
diff --git a/lib/logging_utils.py b/lib/logging_utils.py
index e621d5e..0cdbea9 100644
--- a/lib/logging_utils.py
+++ b/lib/logging_utils.py
@@ -5,15 +5,17 @@
"""
import gen_print as gp
+import variables as var
+import gen_robot_utils as gru
import sys
import os
import imp
+
+from robot.libraries.BuiltIn import BuiltIn
+
base_path = os.path.dirname(os.path.dirname(
imp.find_module("gen_robot_print")[1])) + os.sep
sys.path.append(base_path + "data/")
-import variables as var
-from robot.libraries.BuiltIn import BuiltIn
-import gen_robot_utils as gru
gru.my_import_resource("logging_utils.robot")
diff --git a/lib/obmc_boot_test.py b/lib/obmc_boot_test.py
index 0dc245d..79358a6 100755
--- a/lib/obmc_boot_test.py
+++ b/lib/obmc_boot_test.py
@@ -33,12 +33,12 @@
import gen_plug_in_utils as gpu
import pel_utils as pel
import logging_utils as log
+import run_keyword as rk
base_path = os.path.dirname(os.path.dirname(
imp.find_module("gen_robot_print")[1])) +\
os.sep
sys.path.append(base_path + "extended/")
-import run_keyword as rk
# Setting master_pid correctly influences the behavior of plug-ins like
# DB_Logging
diff --git a/lib/pel_utils.py b/lib/pel_utils.py
index d361a4e..b06124c 100644
--- a/lib/pel_utils.py
+++ b/lib/pel_utils.py
@@ -6,6 +6,8 @@
import func_args as fa
import bmc_ssh_utils as bsu
+import pel_variables
+
import json
import os
import sys
@@ -14,8 +16,6 @@
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_path + "/data/")
-import pel_variables
-
class peltool_exception(Exception):
r"""
diff --git a/lib/state_map.py b/lib/state_map.py
index 5d72b5a..f8353de 100644
--- a/lib/state_map.py
+++ b/lib/state_map.py
@@ -6,6 +6,10 @@
- Defines Valid states of the system
"""
+
+import gen_robot_keyword as keyword
+import variables as var
+
import os
import re
import sys
@@ -16,8 +20,6 @@
repo_data_dir_path = re.sub('/lib', '/data', robot_pgm_dir_path)
sys.path.append(repo_data_dir_path)
-import gen_robot_keyword as keyword
-import variables as var
BuiltIn().import_resource("state_manager.robot")
BuiltIn().import_resource("rest_client.robot")