Replace more pylint sections with ruff
This commit is contained in:
parent
aea1373df7
commit
9dc900c75e
8 changed files with 26 additions and 39 deletions
|
|
@ -1,12 +1,7 @@
|
||||||
"""WizardKit: Launch Stress Tests Tool"""
|
"""WizardKit: Launch Stress Tests Tool"""
|
||||||
# vim: sts=2 sw=2 ts=2
|
# vim: sts=2 sw=2 ts=2
|
||||||
|
|
||||||
import os
|
import wk
|
||||||
import sys
|
|
||||||
|
|
||||||
os.chdir(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
sys.path.append(os.getcwd())
|
|
||||||
import wk # pylint: disable=wrong-import-position
|
|
||||||
|
|
||||||
wk.kit.tools.run_tool('CoreTemp', 'CoreTemp', popen=True)
|
wk.kit.tools.run_tool('CoreTemp', 'CoreTemp', popen=True)
|
||||||
wk.kit.tools.run_tool('FurMark', 'FurMark', popen=True)
|
wk.kit.tools.run_tool('FurMark', 'FurMark', popen=True)
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,13 @@
|
||||||
"wk/setup/__init__.py" = ["F401"]
|
"wk/setup/__init__.py" = ["F401"]
|
||||||
|
|
||||||
# Long lines
|
# Long lines
|
||||||
"wk/borrowed/acpi.py" = ["E501", "F841"]
|
"auto_setup.py" = ["E501"]
|
||||||
"wk/cfg/ddrescue.py" = ["E501"]
|
"wk/cfg/ddrescue.py" = ["E501"]
|
||||||
"wk/cfg/hw.py" = ["E501"]
|
"wk/cfg/hw.py" = ["E501"]
|
||||||
"wk/cfg/launchers.py" = ["E501"]
|
"wk/cfg/launchers.py" = ["E501"]
|
||||||
"wk/cfg/setup.py" = ["E501"]
|
"wk/cfg/setup.py" = ["E501"]
|
||||||
"wk/cfg/sources.py" = ["E501"]
|
"wk/cfg/sources.py" = ["E501"]
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
"set_lp8550_slope.py" = ["E501", "E741"]
|
||||||
|
"wk/borrowed/acpi.py" = ["E501", "F841"]
|
||||||
|
|
|
||||||
|
|
@ -168,14 +168,13 @@ def export_and_upload_graphs(state, test_obj, rate_list):
|
||||||
image_path, state.ost.ticket_id, test_obj.dev.path.name)
|
image_path, state.ost.ticket_id, test_obj.dev.path.name)
|
||||||
test_obj.report.append(f'Imgur: {imgur_url}')
|
test_obj.report.append(f'Imgur: {imgur_url}')
|
||||||
test_obj.report.append(f'Nextcloud: {nextcloud_url}')
|
test_obj.report.append(f'Nextcloud: {nextcloud_url}')
|
||||||
except Exception as err: # pylint: disable=broad-except
|
except Exception as err:
|
||||||
LOG.error('%s', err)
|
LOG.error('%s', err)
|
||||||
LOG.error('Failed to upload graph')
|
LOG.error('Failed to upload graph')
|
||||||
test_obj.report.append('Failed to upload graph')
|
test_obj.report.append('Failed to upload graph')
|
||||||
|
|
||||||
|
|
||||||
def run_io_test(state, test_obj, log_path, test_mode=False) -> None:
|
def run_io_test(state, test_obj, log_path, test_mode=False) -> None:
|
||||||
#pylint: disable=too-many-locals
|
|
||||||
"""Run I/O benchmark and handle exceptions."""
|
"""Run I/O benchmark and handle exceptions."""
|
||||||
dev_path = test_obj.dev.path
|
dev_path = test_obj.dev.path
|
||||||
if PLATFORM == 'Darwin':
|
if PLATFORM == 'Darwin':
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
"""WizardKit: Hardware diagnostics"""
|
"""WizardKit: Hardware diagnostics"""
|
||||||
# pylint: disable=too-many-lines
|
|
||||||
# vim: sts=2 sw=2 ts=2
|
# vim: sts=2 sw=2 ts=2
|
||||||
|
|
||||||
import atexit
|
import atexit
|
||||||
|
|
@ -97,7 +96,6 @@ PLATFORM = std.PLATFORM
|
||||||
|
|
||||||
# Classes
|
# Classes
|
||||||
class State():
|
class State():
|
||||||
# pylint: disable=too-many-instance-attributes
|
|
||||||
"""Object for tracking hardware diagnostic data."""
|
"""Object for tracking hardware diagnostic data."""
|
||||||
def __init__(self, test_mode=False):
|
def __init__(self, test_mode=False):
|
||||||
self.cpu_max_temp = -1
|
self.cpu_max_temp = -1
|
||||||
|
|
@ -812,7 +810,6 @@ def disk_surface_scan(state, test_objects, test_mode=False) -> None:
|
||||||
|
|
||||||
|
|
||||||
def disk_volume_utilization(state, test_objects, test_mode=False) -> None:
|
def disk_volume_utilization(state, test_objects, test_mode=False) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
"""Check disk for full volumes."""
|
"""Check disk for full volumes."""
|
||||||
LOG.info('Disk Utilization')
|
LOG.info('Disk Utilization')
|
||||||
for test in test_objects:
|
for test in test_objects:
|
||||||
|
|
@ -836,7 +833,7 @@ def main() -> None:
|
||||||
atexit.register(tmux.kill_all_panes)
|
atexit.register(tmux.kill_all_panes)
|
||||||
menu = build_menu(cli_mode=args['--cli'], quick_mode=args['--quick'])
|
menu = build_menu(cli_mode=args['--cli'], quick_mode=args['--quick'])
|
||||||
state = State(test_mode=args['--test-mode'])
|
state = State(test_mode=args['--test-mode'])
|
||||||
state.override_all_smart_errors = args['--ignore-smart-errors'] # pylint: disable=attribute-defined-outside-init
|
state.override_all_smart_errors = args['--ignore-smart-errors']
|
||||||
|
|
||||||
# Quick Mode
|
# Quick Mode
|
||||||
if args['--quick']:
|
if args['--quick']:
|
||||||
|
|
@ -897,7 +894,6 @@ def main() -> None:
|
||||||
|
|
||||||
|
|
||||||
def post_system_info(state, quick_mode=False, test_mode=False) -> None:
|
def post_system_info(state, quick_mode=False, test_mode=False) -> None:
|
||||||
# pylint: disable=unused-argument
|
|
||||||
"""Post system info to osTicket."""
|
"""Post system info to osTicket."""
|
||||||
# Bail early
|
# Bail early
|
||||||
if state.ost.disabled:
|
if state.ost.disabled:
|
||||||
|
|
@ -948,24 +944,6 @@ def run_diags(state, menu, quick_mode=False, test_mode=False) -> None:
|
||||||
atexit.register(state.save_debug_reports)
|
atexit.register(state.save_debug_reports)
|
||||||
state.init_diags(menu)
|
state.init_diags(menu)
|
||||||
|
|
||||||
def _init_osticket():
|
|
||||||
"""Dumb private function to avoid pylint error."""
|
|
||||||
if not state.ost.disabled:
|
|
||||||
# Select Ticket
|
|
||||||
state.ost.select_ticket()
|
|
||||||
|
|
||||||
# Update top_text
|
|
||||||
if state.ost.ticket_id:
|
|
||||||
state.top_text += std.color_string(
|
|
||||||
[f' #{state.ost.ticket_id}', state.ost.ticket_name],
|
|
||||||
[None, 'CYAN'],
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add note
|
|
||||||
if (state.ost.ticket_id
|
|
||||||
and menu.toggles['osTicket Tech Note']['Selected']):
|
|
||||||
state.ost.add_note()
|
|
||||||
|
|
||||||
# Just return if no tests were selected
|
# Just return if no tests were selected
|
||||||
if not state.test_groups:
|
if not state.test_groups:
|
||||||
std.print_warning('No tests selected?')
|
std.print_warning('No tests selected?')
|
||||||
|
|
@ -973,7 +951,21 @@ def run_diags(state, menu, quick_mode=False, test_mode=False) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# osTicket
|
# osTicket
|
||||||
_init_osticket()
|
if not state.ost.disabled:
|
||||||
|
# Select Ticket
|
||||||
|
state.ost.select_ticket()
|
||||||
|
|
||||||
|
# Update top_text
|
||||||
|
if state.ost.ticket_id:
|
||||||
|
state.top_text += std.color_string(
|
||||||
|
[f' #{state.ost.ticket_id}', state.ost.ticket_name],
|
||||||
|
[None, 'CYAN'],
|
||||||
|
)
|
||||||
|
|
||||||
|
# Add note
|
||||||
|
if (state.ost.ticket_id
|
||||||
|
and menu.toggles['osTicket Tech Note']['Selected']):
|
||||||
|
state.ost.add_note()
|
||||||
|
|
||||||
# Run tests
|
# Run tests
|
||||||
for group in state.test_groups:
|
for group in state.test_groups:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Functions
|
# Functions
|
||||||
def build_report(dev, dev_type, num_disk_tests=None):
|
def build_report(dev, dev_type, num_disk_tests=None):
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
"""Build report for posting to osTicket, returns str."""
|
"""Build report for posting to osTicket, returns str."""
|
||||||
report = []
|
report = []
|
||||||
|
|
||||||
|
|
@ -162,7 +161,6 @@ def post_disk_results(state, num_disk_tests):
|
||||||
|
|
||||||
|
|
||||||
def update_checkboxes(state, num_disk_tests):
|
def update_checkboxes(state, num_disk_tests):
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
"""Update osTicket checkboxes after confirmation."""
|
"""Update osTicket checkboxes after confirmation."""
|
||||||
cpu_tests = []
|
cpu_tests = []
|
||||||
disk_tests = []
|
disk_tests = []
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ def get_apfs_volumes(device_path):
|
||||||
|
|
||||||
|
|
||||||
def get_core_storage_volumes(device_path):
|
def get_core_storage_volumes(device_path):
|
||||||
# pylint: disable=too-many-branches
|
|
||||||
"""Get CoreStorage volumes contained in device_path, returns list."""
|
"""Get CoreStorage volumes contained in device_path, returns list."""
|
||||||
disks = []
|
disks = []
|
||||||
volumes = []
|
volumes = []
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ TABLE_TICKET = 'ost_ticket'
|
||||||
|
|
||||||
|
|
||||||
# Classes
|
# Classes
|
||||||
class osTicket(): # pylint: disable=invalid-name
|
class osTicket():
|
||||||
"""Class to track osTicket data and functions."""
|
"""Class to track osTicket data and functions."""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.db_connection = None
|
self.db_connection = None
|
||||||
|
|
|
||||||
|
|
@ -1573,7 +1573,7 @@ def open_defender_settings(disable=False, enable=False):
|
||||||
proc = run_program(cmd)
|
proc = run_program(cmd)
|
||||||
status = proc.stdout.split('=')[1]
|
status = proc.stdout.split('=')[1]
|
||||||
enabled = bool(int(status) & MS_ANTIVIRUS_ENABLED)
|
enabled = bool(int(status) & MS_ANTIVIRUS_ENABLED)
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception:
|
||||||
# Unknown result, just show the prompt
|
# Unknown result, just show the prompt
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue