Drop OrderedDict usage in favor of standard dicts
Python 3.7+ guarantees insertion order is preserved and we (currently) require 3.10+
This commit is contained in:
parent
a253fdc80f
commit
2cce572acf
4 changed files with 12 additions and 20 deletions
|
|
@ -1,16 +1,14 @@
|
|||
"""WizardKit: Config - ddrescue"""
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
# Layout
|
||||
TMUX_SIDE_WIDTH = 21
|
||||
TMUX_LAYOUT = OrderedDict({
|
||||
TMUX_LAYOUT = {
|
||||
'Source': {'height': 2, 'Check': True},
|
||||
'Started': {'width': TMUX_SIDE_WIDTH, 'Check': True},
|
||||
'Progress': {'width': TMUX_SIDE_WIDTH, 'Check': True},
|
||||
})
|
||||
}
|
||||
|
||||
# ddrescue
|
||||
AUTO_PASS_THRESHOLDS = {
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
"""WizardKit: Config - UFD"""
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from wk.cfg.main import KIT_NAME_FULL
|
||||
|
||||
|
||||
# General
|
||||
SOURCES = OrderedDict({
|
||||
SOURCES = {
|
||||
'Linux': {'Arg': '--linux', 'Type': 'ISO'},
|
||||
'WinPE': {'Arg': '--winpe', 'Type': 'ISO'},
|
||||
'Main Kit': {'Arg': '--main-kit', 'Type': 'KIT'},
|
||||
'Extra Dir': {'Arg': '--extra-dir', 'Type': 'DIR'},
|
||||
})
|
||||
}
|
||||
|
||||
# Definitions: Boot entries
|
||||
BOOT_ENTRIES = {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@ import shutil
|
|||
import subprocess
|
||||
import time
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
import psutil
|
||||
import pytz
|
||||
|
||||
|
|
@ -141,12 +139,12 @@ class BlockPair():
|
|||
self.map_data = {}
|
||||
self.map_path = None
|
||||
self.size = source.size
|
||||
self.status = OrderedDict({
|
||||
self.status = {
|
||||
'read-skip': 'Pending',
|
||||
'read-full': 'Pending',
|
||||
'trim': 'Pending',
|
||||
'scrape': 'Pending',
|
||||
})
|
||||
}
|
||||
self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ
|
||||
self.view_proc = None
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
"""WizardKit: UFD Functions"""
|
||||
# vim: sts=2 sw=2 ts=2
|
||||
|
||||
# TODO: Drop OrderedDict use
|
||||
|
||||
import logging
|
||||
import math
|
||||
import os
|
||||
|
|
@ -10,7 +8,6 @@ import pathlib
|
|||
import shutil
|
||||
from subprocess import CalledProcessError
|
||||
|
||||
from collections import OrderedDict
|
||||
from docopt import docopt
|
||||
|
||||
from wk import io, log
|
||||
|
|
@ -618,7 +615,7 @@ def update_boot_entries(ufd_dev, images=None) -> None:
|
|||
|
||||
def verify_sources(args, ufd_sources) -> dict[str, pathlib.Path]:
|
||||
"""Check all sources and abort if necessary, returns dict."""
|
||||
sources = OrderedDict()
|
||||
sources = {}
|
||||
|
||||
for label, data in ufd_sources.items():
|
||||
s_path = args[data['Arg']]
|
||||
|
|
@ -628,10 +625,11 @@ def verify_sources(args, ufd_sources) -> dict[str, pathlib.Path]:
|
|||
except FileNotFoundError:
|
||||
ui.print_error(f'ERROR: {label} not found: {s_path}')
|
||||
ui.abort()
|
||||
if not is_valid_path(s_path_obj, data['Type']):
|
||||
ui.print_error(f'ERROR: Invalid {label} source: {s_path}')
|
||||
ui.abort()
|
||||
sources[label] = s_path_obj
|
||||
else:
|
||||
if not is_valid_path(s_path_obj, data['Type']):
|
||||
ui.print_error(f'ERROR: Invalid {label} source: {s_path}')
|
||||
ui.abort()
|
||||
sources[label] = s_path_obj
|
||||
|
||||
return sources
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue