black: re-format
black and isort are enabled in the openbmc-build-scripts on Python files
to have a consistent formatting. Re-run the formatter on the whole
repository.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I944f1915ece753f72a3fa654902d445a9749d0f9
diff --git a/gui/data/gui_variables.py b/gui/data/gui_variables.py
index 0fe686a..663f9b0 100644
--- a/gui/data/gui_variables.py
+++ b/gui/data/gui_variables.py
@@ -5,8 +5,7 @@
"""
-class gui_variables():
-
+class gui_variables:
# Login page
xpath_textbox_hostname = "//input[@id='host']"
xpath_textbox_username = "//*[@data-test-id='login-input-username']"
@@ -20,8 +19,12 @@
# GUI header
xpath_root_button_menu = "//*[@data-test-id='appHeader-container-user']"
xpath_profile_settings = "//*[@data-test-id='appHeader-link-profile']"
- xpath_server_health_header = "//*[@data-test-id='appHeader-container-health']"
- xpath_server_power_header = "//*[@data-test-id='appHeader-container-power']"
+ xpath_server_health_header = (
+ "//*[@data-test-id='appHeader-container-health']"
+ )
+ xpath_server_power_header = (
+ "//*[@data-test-id='appHeader-container-power']"
+ )
xpath_refresh_button = "//*[@data-test-id='appHeader-button-refresh']"
# Logs menu
@@ -30,21 +33,33 @@
xpath_dumps_header = "//h1[text()='Dumps']"
xpath_event_logs_sub_menu = "//*[@data-test-id='nav-item-event-logs']"
xpath_event_logs_heading = "//h1[contains(text(), 'Event logs')]"
- xpath_progress_logs_sub_menu = "//*[@data-test-id='nav-item-post-code-logs']"
+ xpath_progress_logs_sub_menu = (
+ "//*[@data-test-id='nav-item-post-code-logs']"
+ )
# Hardware status menu
- xpath_hardware_status_menu = "//*[@data-test-id='nav-button-hardware-status']"
- xpath_inventory_and_leds_sub_menu = "//*[@data-test-id='nav-item-inventory']"
+ xpath_hardware_status_menu = (
+ "//*[@data-test-id='nav-button-hardware-status']"
+ )
+ xpath_inventory_and_leds_sub_menu = (
+ "//*[@data-test-id='nav-item-inventory']"
+ )
xpath_sensor_sub_menu = "//*[@data-test-id='nav-item-sensors']"
- xpath_inventory_and_leds_heading = "//h1[contains(text(), 'Inventory and LEDs')]"
+ xpath_inventory_and_leds_heading = (
+ "//h1[contains(text(), 'Inventory and LEDs')]"
+ )
# Operations menu
xpath_operations_menu = "//*[@data-test-id='nav-button-operations']"
- xpath_factory_reset_sub_menu = "//*[@data-test-id='nav-item-factory-reset']"
+ xpath_factory_reset_sub_menu = (
+ "//*[@data-test-id='nav-item-factory-reset']"
+ )
xpath_firmware_update_sub_menu = "//*[@data-test-id='nav-item-firmware']"
xpath_reboot_bmc_sub_menu = "//*[@data-test-id='nav-item-reboot-bmc']"
xpath_host_console_sub_menu = "//*[@data-test-id='nav-item-host-console']"
- xpath_server_power_operations_sub_menu = "//*[@data-test-id='nav-item-server-power-operations']"
+ xpath_server_power_operations_sub_menu = (
+ "//*[@data-test-id='nav-item-server-power-operations']"
+ )
xpath_host_console_heading = "//h1[text()='Host console']"
xpath_firmware_heading = "//h1[contains(text(), 'Firmware')]"
@@ -53,33 +68,49 @@
xpath_network_heading = "//h1[text()='Network']"
xpath_date_time_sub_menu = "//*[@data-test-id='nav-item-date-time']"
xpath_network_sub_menu = "//*[@data-test-id='nav-item-network']"
- xpath_power_restore_policy_sub_menu = "//*[@data-test-id='nav-item-power-restore-policy']"
+ xpath_power_restore_policy_sub_menu = (
+ "//*[@data-test-id='nav-item-power-restore-policy']"
+ )
# Security and access menu
- xpath_secuity_and_accesss_menu = "//*[@data-test-id='nav-button-security-and-access']"
+ xpath_secuity_and_accesss_menu = (
+ "//*[@data-test-id='nav-button-security-and-access']"
+ )
xpath_sessions_sub_menu = "//*[@data-test-id='nav-item-sessions']"
xpath_ldap_sub_menu = "//*[@data-test-id='nav-item-ldap']"
- xpath_user_management_sub_menu = "//*[@data-test-id='nav-item-user-management']"
+ xpath_user_management_sub_menu = (
+ "//*[@data-test-id='nav-item-user-management']"
+ )
xpath_policies_sub_menu = "//*[@data-test-id='nav-item-policies']"
xpath_certificates_sub_menu = "//*[@data-test-id='nav-item-certificates']"
# Resource management menu
- xpath_resource_management_menu = "//*[@data-test-id='nav-button-resource-management']"
+ xpath_resource_management_menu = (
+ "//*[@data-test-id='nav-button-resource-management']"
+ )
xpath_power_sub_menu = "//*[@data-test-id='nav-item-power']"
xpath_power_heading = "//h1[contains(text(), 'Power')]"
# Profile settings
xpath_default_UTC = "//*[@data-test-id='profileSettings-radio-defaultUTC']"
- xpath_profile_save_button = "//*[@data-test-id='profileSettings-button-saveSettings']"
- xpath_input_password = "//*[@data-test-id='profileSettings-input-newPassword']"
- xpath_input_confirm_password = "//*[@data-test-id='profileSettings-input-confirmPassword']"
+ xpath_profile_save_button = (
+ "//*[@data-test-id='profileSettings-button-saveSettings']"
+ )
+ xpath_input_password = (
+ "//*[@data-test-id='profileSettings-input-newPassword']"
+ )
+ xpath_input_confirm_password = (
+ "//*[@data-test-id='profileSettings-input-confirmPassword']"
+ )
# Common variables
xpath_save_settings_button = "//button[contains(text(),'Save')]"
xpath_confirm_button = "//button[contains(text(),'Confirm')]"
xpath_cancel_button = "//button[contains(text(),'Cancel')]"
xpath_add_button = "//button[normalize-space(text())='Add']"
- xpath_page_loading_progress_bar = "//*[@aria-label='Page loading progress bar']"
+ xpath_page_loading_progress_bar = (
+ "//*[@aria-label='Page loading progress bar']"
+ )
# Reboot sub menu
xpath_reboot_bmc_heading = "//h1[text()='Reboot BMC']"
diff --git a/gui/data/resource_variables.py b/gui/data/resource_variables.py
index 07413d7..e70a324 100644
--- a/gui/data/resource_variables.py
+++ b/gui/data/resource_variables.py
@@ -6,8 +6,7 @@
"""
-class resource_variables():
-
+class resource_variables:
xpath_textbox_hostname = "//input[@id='host']"
xpath_textbox_username = "//input[@id='username']"
xpath_textbox_password = "//input[@id='password']"
@@ -27,38 +26,38 @@
xpath_remove_button = "//button[contains(text(),'Remove')]"
xpath_add_button = "//button[@type='submit']"
- xpath_select_button_warm_reboot = \
- "//*[@id='power__warm-boot']"
- xpath_operation_warning_message = \
- "//*[@class='inline__confirm active']"
+ xpath_select_button_warm_reboot = "//*[@id='power__warm-boot']"
+ xpath_operation_warning_message = "//*[@class='inline__confirm active']"
text_warm_reboot_warning_message = "warm reboot?"
- xpath_select_button_warm_reboot_yes = \
- "//*[@id='power-operations']" \
+ xpath_select_button_warm_reboot_yes = (
+ "//*[@id='power-operations']"
"/div[3]/div[3]/confirm/div/div[2]/button[1]"
+ )
- xpath_select_button_cold_reboot = \
- "//*[@id='power__cold-boot']"
+ xpath_select_button_cold_reboot = "//*[@id='power__cold-boot']"
text_cold_reboot_warning_message = "cold reboot?"
- xpath_select_button_cold_reboot_yes = \
- "//*[@id='power-operations']" \
+ xpath_select_button_cold_reboot_yes = (
+ "//*[@id='power-operations']"
"/div[3]/div[4]/confirm/div/div[2]/button[2]"
+ )
- xpath_select_button_orderly_shutdown = \
- "//*[@id='power__soft-shutdown']"
- xpath_select_button_orderly_shutdown_button_no = \
- "//*[@id='power-operations']/div[3]/div[5]"\
+ xpath_select_button_orderly_shutdown = "//*[@id='power__soft-shutdown']"
+ xpath_select_button_orderly_shutdown_button_no = (
+ "//*[@id='power-operations']/div[3]/div[5]"
"/confirm/div/div[2]/button[2]"
+ )
text_orderly_shutdown_warning_message = "orderly shutdown?"
- xpath_select_button_orderly_shutdown_yes = \
- "//*[@id='power-operations']/div[3]/div[5]" \
+ xpath_select_button_orderly_shutdown_yes = (
+ "//*[@id='power-operations']/div[3]/div[5]"
"/confirm/div/div[2]/button[1]"
+ )
- xpath_select_button_immediate_shutdown = \
- "//*[@id='power__hard-shutdown']"
+ xpath_select_button_immediate_shutdown = "//*[@id='power__hard-shutdown']"
text_immediate_shutdown_warning_message = "immediate shutdown?"
- xpath_select_button_immediate_shutdown_yes = \
- "//*[@id='power-operations']/div[3]/div[6]" \
+ xpath_select_button_immediate_shutdown_yes = (
+ "//*[@id='power-operations']/div[3]/div[6]"
"/confirm/div/div[2]/button[1]"
+ )
obmc_off_state = "Off"
obmc_standby_state = "Standby"
@@ -66,13 +65,21 @@
# xpath for main menu.
xpath_select_server_control = "//button[contains(@class,'btn-control')]"
- xpath_select_server_configuration = "//button[contains(@class,'btn-config')]"
- xpath_select_access_control = "//button[contains(@class,'btn-access-control')]"
+ xpath_select_server_configuration = (
+ "//button[contains(@class,'btn-config')]"
+ )
+ xpath_select_access_control = (
+ "//button[contains(@class,'btn-access-control')]"
+ )
# xpath for sub main menu.
- xpath_select_server_power_operations = "//a[@href='#/server-control/power-operations']"
+ xpath_select_server_power_operations = (
+ "//a[@href='#/server-control/power-operations']"
+ )
xpath_select_snmp_settings = "//a[@href='#/configuration/snmp']"
- xpath_select_manage_power_usage = "//a[@href='#/server-control/power-usage']"
+ xpath_select_manage_power_usage = (
+ "//a[@href='#/server-control/power-usage']"
+ )
xpath_select_virtual_media = "//a[@href='#/server-control/virtual-media']"
xpath_select_sol_console = "//a[@href='#/server-control/remote-console']"
xpath_select_reboot_bmc = "//a[@href='#/server-control/bmc-reboot']"
@@ -83,40 +90,53 @@
xpath_select_local_users = "//a[@href='#/access-control/local-users']"
# GUI header elements locators.
- xpath_select_server_power = "//a[@href='#/server-control/power-operations']"
+ xpath_select_server_power = (
+ "//a[@href='#/server-control/power-operations']"
+ )
# Server health elements locators.
- xpath_select_refresh_button = \
- "//*[contains(text(),'Refresh')]"
- xpath_event_severity_all = "//*[text()='Filter by severity']/following-sibling::button[1]"
- xpath_event_severity_high = "//*[text()='Filter by severity']/following-sibling::button[2]"
- xpath_event_severity_medium = "//*[text()='Filter by severity']/following-sibling::button[3]"
- xpath_event_severity_low = "//*[text()='Filter by severity']/following-sibling::button[4]"
- xpath_drop_down_timezone_edt = \
+ xpath_select_refresh_button = "//*[contains(text(),'Refresh')]"
+ xpath_event_severity_all = (
+ "//*[text()='Filter by severity']/following-sibling::button[1]"
+ )
+ xpath_event_severity_high = (
+ "//*[text()='Filter by severity']/following-sibling::button[2]"
+ )
+ xpath_event_severity_medium = (
+ "//*[text()='Filter by severity']/following-sibling::button[3]"
+ )
+ xpath_event_severity_low = (
+ "//*[text()='Filter by severity']/following-sibling::button[4]"
+ )
+ xpath_drop_down_timezone_edt = (
"//*[@id='event-log']/section[1]/div/div/button"
+ )
xpath_refresh_circle = "/html/body/main/loader/div[1]/svg/circle"
- xpath_drop_down_timezone_utc = \
+ xpath_drop_down_timezone_utc = (
"//*[@id='event-log']/section[1]/div/div/ul/li[2]/button"
+ )
xpath_event_filter_all = "//*[text()='All events']"
xpath_event_filter_resolved = "//*[text()='Resolved events']"
xpath_event_filter_unresolved = "//*[text()='Unresolved events']"
- xpath_event_action_bars = \
- "//*[@id='event__actions-bar']/div[1]/label/span"
- xpath_event_action_delete = \
+ xpath_event_action_bars = "//*[@id='event__actions-bar']/div[1]/label/span"
+ xpath_event_action_delete = (
"//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
- xpath_event_action_export = \
- "//*[@id='event__actions-bar']/div[2]/div[2]/a"
- xpath_number_of_events = \
- "//*[@id='event__actions-bar']/div[2]/p[2]/span"
- xpath_mark_as_resolved = \
+ )
+ xpath_event_action_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
+ xpath_number_of_events = "//*[@id='event__actions-bar']/div[2]/p[2]/span"
+ xpath_mark_as_resolved = (
"//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
+ )
xpath_events_export = "//*[@id='event__actions-bar']/div[2]/div[2]/a"
xpath_individual_event_select = "(//*[@class='control__indicator'])[2]"
- xpath_individual_event_delete = \
+ xpath_individual_event_delete = (
"//*[@id='event__actions-bar']/div[2]/div[2]/button[1]"
+ )
xpath_second_event_select = "(//*[@class='control__indicator'])[3]"
- xpath_individual_event_resolved = \
+ xpath_individual_event_resolved = (
"//*[@id='event__actions-bar']/div[2]/div[2]/button[2]"
- xpath_individual_event_export = \
+ )
+ xpath_individual_event_export = (
"//*[@id='event__actions-bar']/div[2]/div[2]/a"
+ )
xpath_select_all_events = "(//*[@class='control__indicator'])[1]"
diff --git a/gui/lib/supporting_libs.py b/gui/lib/supporting_libs.py
index 4cc3044..ae7d005 100644
--- a/gui/lib/supporting_libs.py
+++ b/gui/lib/supporting_libs.py
@@ -9,7 +9,6 @@
import socket
-class supporting_libs():
-
+class supporting_libs:
def get_hostname_from_ip_address(self, ip):
return socket.gethostbyaddr(ip)[0]
diff --git a/gui/lib/utils_get_version.py b/gui/lib/utils_get_version.py
index 0c7f279..3f1d331 100755
--- a/gui/lib/utils_get_version.py
+++ b/gui/lib/utils_get_version.py
@@ -1,11 +1,19 @@
#!/usr/bin/env python3
-import gen_print as gp
-import gen_cmd as gc
import collections
-module_names = ['Selenium2Library', 'SeleniumLibrary', 'SSHLibrary', 'requests',
- 'XvfbRobot', 'robotremoteserver', 'redfish']
+import gen_cmd as gc
+import gen_print as gp
+
+module_names = [
+ "Selenium2Library",
+ "SeleniumLibrary",
+ "SSHLibrary",
+ "requests",
+ "XvfbRobot",
+ "robotremoteserver",
+ "redfish",
+]
import_versions = collections.OrderedDict()
@@ -13,8 +21,13 @@
try:
cmd_buf = "import " + module_name
exec(cmd_buf)
- cmd_buf = "import_versions['" + module_name + "'] = " + module_name \
- + ".__version__"
+ cmd_buf = (
+ "import_versions['"
+ + module_name
+ + "'] = "
+ + module_name
+ + ".__version__"
+ )
exec(cmd_buf)
except ImportError:
import_versions[module_name] = "Not installed"
@@ -50,21 +63,30 @@
quiet = 1
versions = collections.OrderedDict()
- for package in ['python', 'python3', 'robot', 'firefox', 'google-chrome']:
+ for package in ["python", "python3", "robot", "firefox", "google-chrome"]:
# Note: "robot --version" returns 0x00000000000000fb.
# Note: If package does not exist, 0x7f is returned.
- rc, version = gc.shell_cmd(package + " --version",
- valid_rcs=[0, 0x7f, 0xfb])
- versions[package] = "Not installed" if rc == 0x7f else version.rstrip('\n')
+ rc, version = gc.shell_cmd(
+ package + " --version", valid_rcs=[0, 0x7F, 0xFB]
+ )
+ versions[package] = (
+ "Not installed" if rc == 0x7F else version.rstrip("\n")
+ )
versions.update(import_versions)
- for package in ['robotframework-angularjs', 'robotframework-scplibrary',
- 'robotframework-extendedselenium2library']:
- rc, version = gc.shell_cmd("pip3 show " + package
- + " | grep Version | sed -re 's/.*: //g'")
- versions[package] = "Not installed" if not version else version.rstrip('\n')
+ for package in [
+ "robotframework-angularjs",
+ "robotframework-scplibrary",
+ "robotframework-extendedselenium2library",
+ ]:
+ rc, version = gc.shell_cmd(
+ "pip3 show " + package + " | grep Version | sed -re 's/.*: //g'"
+ )
+ versions[package] = (
+ "Not installed" if not version else version.rstrip("\n")
+ )
rc, version = gc.shell_cmd("lsb_release -d -s")
- versions["host OS"] = "Failed" if not version else version.rstrip('\n')
+ versions["host OS"] = "Failed" if not version else version.rstrip("\n")
return versions