Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
2Shirt 2021-04-09 00:16:41 -06:00
commit af09772d67
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
6 changed files with 19 additions and 14 deletions

View file

@ -179,7 +179,7 @@ class State():
disable_tests = False disable_tests = False
# Skip already disabled devices # Skip already disabled devices
if all([test.disabled for test in disk.tests.values()]): if all(test.disabled for test in disk.tests.values()):
continue continue
try: try:
@ -190,7 +190,7 @@ class State():
if 'Disk Attributes' in disk.tests: if 'Disk Attributes' in disk.tests:
disk.tests['Disk Attributes'].failed = True disk.tests['Disk Attributes'].failed = True
disk.tests['Disk Attributes'].set_status('Failed') disk.tests['Disk Attributes'].set_status('Failed')
except hw_obj.SMARTSelfTestInProgressError: except hw_obj.SMARTSelfTestInProgressError as err:
if prep: if prep:
std.print_warning(f'SMART self-test(s) in progress for {disk.path}') std.print_warning(f'SMART self-test(s) in progress for {disk.path}')
if std.ask('Continue with all tests disabled for this device?'): if std.ask('Continue with all tests disabled for this device?'):
@ -199,7 +199,7 @@ class State():
std.print_standard('Diagnostics aborted.') std.print_standard('Diagnostics aborted.')
std.print_standard(' ') std.print_standard(' ')
std.pause('Press Enter to exit...') std.pause('Press Enter to exit...')
raise SystemExit(1) raise SystemExit(1) from err
elif wait_for_self_tests: elif wait_for_self_tests:
self_tests_in_progress = True self_tests_in_progress = True
else: else:
@ -907,10 +907,10 @@ def disk_io_benchmark(state, test_objects, skip_usb=True):
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
) )
except PermissionError: except PermissionError as err:
# Since we're using sudo we can't kill dd # Since we're using sudo we can't kill dd
# Assuming this happened during a CTRL+c # Assuming this happened during a CTRL+c
raise KeyboardInterrupt raise KeyboardInterrupt from err
match = IO_RATE_REGEX.search(proc.stdout) match = IO_RATE_REGEX.search(proc.stdout)
if match: if match:
read_rates.append( read_rates.append(
@ -1046,7 +1046,7 @@ def disk_self_test(state, test_objects):
state.update_progress_pane() state.update_progress_pane()
try: try:
while True: while True:
if any([t.is_alive() for t in threads]): if any(t.is_alive() for t in threads):
std.sleep(1) std.sleep(1)
else: else:
break break
@ -1125,7 +1125,7 @@ def disk_surface_scan(state, test_objects):
continue continue
match = BADBLOCKS_REGEX.search(line) match = BADBLOCKS_REGEX.search(line)
if match: if match:
if all([s == '0' for s in match.groups()]): if all(s == '0' for s in match.groups()):
test_obj.passed = True test_obj.passed = True
test_obj.report.append(f' {line}') test_obj.report.append(f' {line}')
test_obj.set_status('Passed') test_obj.set_status('Passed')
@ -1168,7 +1168,7 @@ def disk_surface_scan(state, test_objects):
# Wait for all tests to complete # Wait for all tests to complete
try: try:
while True: while True:
if any([t.is_alive() for t in threads]): if any(t.is_alive() for t in threads):
state.update_progress_pane() state.update_progress_pane()
std.sleep(5) std.sleep(5)
else: else:
@ -1583,7 +1583,7 @@ def run_diags(state, menu, quick_mode=False):
state.ost.add_note() state.ost.add_note()
# Just return if no tests were selected # Just return if no tests were selected
if not any([details['Enabled'] for details in state.tests.values()]): if not any(details['Enabled'] for details in state.tests.values()):
std.print_warning('No tests selected?') std.print_warning('No tests selected?')
std.pause() std.pause()
return return

View file

@ -62,11 +62,11 @@ class BaseObj():
def all_tests_passed(self): def all_tests_passed(self):
"""Check if all tests passed, returns bool.""" """Check if all tests passed, returns bool."""
return all([results.passed for results in self.tests.values()]) return all(results.passed for results in self.tests.values())
def any_test_failed(self): def any_test_failed(self):
"""Check if any test failed, returns bool.""" """Check if any test failed, returns bool."""
return any([results.failed for results in self.tests.values()]) return any(results.failed for results in self.tests.values())
class CpuRam(BaseObj): class CpuRam(BaseObj):
@ -717,7 +717,7 @@ def get_disks(skip_kits=False):
disks = [ disks = [
disk_obj for disk_obj in disks disk_obj for disk_obj in disks
if not any( if not any(
[WK_LABEL_REGEX.search(label) for label in disk_obj.get_labels()] WK_LABEL_REGEX.search(label) for label in disk_obj.get_labels()
) )
] ]

View file

@ -28,9 +28,9 @@ def case_insensitive_path(path):
for part in parts: for part in parts:
try: try:
real_path = case_insensitive_search(real_path, part) real_path = case_insensitive_search(real_path, part)
except NotADirectoryError: except NotADirectoryError as err:
# Reclassify error # Reclassify error
raise FileNotFoundError(given_path) raise FileNotFoundError(given_path) from err
real_path = pathlib.Path(real_path) real_path = pathlib.Path(real_path)
# Done # Done

View file

@ -90,6 +90,7 @@ def mount(source, mount_point=None, read_write=False):
def mount_volumes(device_path=None, read_write=False, scan_corestorage=False): def mount_volumes(device_path=None, read_write=False, scan_corestorage=False):
# pylint: disable=too-many-branches
"""Mount all detected volumes, returns list. """Mount all detected volumes, returns list.
NOTE: If device_path is specified then only volumes NOTE: If device_path is specified then only volumes

View file

@ -215,6 +215,7 @@ def run_sfc_scan():
# Registry Functions # Registry Functions
def reg_delete_key(hive, key, recurse=False): def reg_delete_key(hive, key, recurse=False):
# pylint: disable=raise-missing-from
"""Delete a key from the registry. """Delete a key from the registry.
NOTE: If recurse is False then it will only work on empty keys. NOTE: If recurse is False then it will only work on empty keys.

View file

@ -220,6 +220,9 @@ function update_live_env() {
cp "$ROOT_DIR/images/Linux.jpg" "$PROFILE_DIR/airootfs/usr/share/wallpaper/burned.in" cp "$ROOT_DIR/images/Linux.jpg" "$PROFILE_DIR/airootfs/usr/share/wallpaper/burned.in"
fi fi
# udevil
mkdir -p "$PROFILE_DIR/airootfs/media"
# WiFi # WiFi
IFS_BAK="${IFS}" IFS_BAK="${IFS}"
IFS=$'\n' IFS=$'\n'