Cleanup imports

This commit is contained in:
2Shirt 2021-10-09 17:16:46 -06:00
parent bc0a358ac0
commit d4392b7285
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
3 changed files with 40 additions and 88 deletions

View file

@ -5,7 +5,6 @@
import atexit
import logging
import os
import platform
import re
import sys
import time
@ -36,6 +35,18 @@ from wk.io import (
)
from wk.kit.tools import (download_tool, get_tool_path, run_tool)
from wk.log import format_log_path, update_log_path
from wk.os.win import (
OS_VERSION,
get_timezone,
set_timezone,
reg_delete_value,
reg_read_value,
reg_set_value,
reg_write_settings,
disable_service,
enable_service,
stop_service,
)
from wk.std import (
GenericError,
GenericWarning,
@ -54,34 +65,6 @@ from wk.std import (
sleep,
strip_colors,
)
if platform.system() == 'Windows':
from wk.os.win import (
OS_VERSION,
get_timezone,
set_timezone,
reg_delete_value,
reg_read_value,
reg_set_value,
reg_write_settings,
disable_service,
enable_service,
stop_service,
)
else:
# Workaround to allow basic testing under non-Windows environments
OS_VERSION = -1
def no_op(*args, **kwargs): # pylint: disable=unused-argument
"""No-op function."""
# wk.os.win
get_timezone = no_op
set_timezone = no_op
reg_delete_value = no_op
reg_read_value = no_op
reg_set_value = no_op
reg_write_settings = no_op
disable_service = no_op
enable_service = no_op
stop_service = no_op
# STATIC VARIABLES

View file

@ -3,6 +3,5 @@
import platform
#if platform.system() == 'Windows':
# from . import win
if platform.system() == 'Windows':
from . import win

View file

@ -6,7 +6,6 @@ import configparser
import logging
import json
import os
import platform
import re
import sys
@ -31,26 +30,6 @@ from wk.kit.tools import (
run_tool,
)
from wk.log import format_log_path, update_log_path
from wk.std import (
GenericError,
GenericWarning,
Menu,
TryAndPrint,
abort,
ask,
clear_screen,
color_string,
pause,
print_error,
print_info,
print_standard,
print_warning,
set_title,
show_data,
sleep,
strip_colors,
)
if platform.system() == 'Windows':
from wk.os.win import (
OS_VERSION,
activate_with_bios,
@ -77,34 +56,25 @@ if platform.system() == 'Windows':
reset_power_plans,
set_system_restore_size,
)
else:
# Workaround to allow basic testing under non-Windows environments
OS_VERSION = -1
def no_op(*args, **kwargs): # pylint: disable=unused-argument
"""No-op function."""
# wk.os.win
activate_with_bios = no_op
check_4k_alignment = no_op
get_installed_antivirus = no_op
get_installed_ram = no_op
get_os_activation = no_op
get_os_name = no_op
get_raw_disks = no_op
get_volume_usage = no_op
is_activated = no_op
is_secure_boot_enabled = no_op
reg_read_value = no_op
reg_set_value = no_op
reg_write_settings = no_op
# wk.repairs.win
backup_all_browser_profiles = no_op
backup_registry = no_op
create_custom_power_plan = no_op
create_system_restore_point = no_op
enable_windows_updates = no_op
export_power_plans = no_op
reset_power_plans = no_op
set_system_restore_size = no_op
from wk.std import (
GenericError,
GenericWarning,
Menu,
TryAndPrint,
abort,
ask,
clear_screen,
color_string,
pause,
print_error,
print_info,
print_standard,
print_warning,
set_title,
show_data,
sleep,
strip_colors,
)
# STATIC VARIABLES