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 atexit
import logging import logging
import os import os
import platform
import re import re
import sys import sys
import time import time
@ -36,6 +35,18 @@ from wk.io import (
) )
from wk.kit.tools import (download_tool, get_tool_path, run_tool) from wk.kit.tools import (download_tool, get_tool_path, run_tool)
from wk.log import format_log_path, update_log_path 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 ( from wk.std import (
GenericError, GenericError,
GenericWarning, GenericWarning,
@ -54,34 +65,6 @@ from wk.std import (
sleep, sleep,
strip_colors, 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 # STATIC VARIABLES

View file

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

View file

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