Skip to content

Commit 5e49019

Browse files
committed
fix(mypy): Fix mypy findings
1 parent 2a5efaf commit 5e49019

5 files changed

Lines changed: 12 additions & 11 deletions

ardupilot_methodic_configurator/backend_filesystem_configuration_steps.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from jsonschema.exceptions import ValidationError
2323

2424
from ardupilot_methodic_configurator import _
25-
from ardupilot_methodic_configurator.data_model_par_dict import Par
25+
from ardupilot_methodic_configurator.data_model_par_dict import Par, ParDict
2626

2727

2828
class ConfigurationSteps:
@@ -42,8 +42,8 @@ def __init__(self, _vehicle_dir: str, vehicle_type: str) -> None:
4242
self.configuration_steps_filename = "configuration_steps_" + vehicle_type + ".json"
4343
self.configuration_steps: dict[str, dict] = {}
4444
self.configuration_phases: dict[str, dict] = {}
45-
self.forced_parameters: dict[str, dict] = {}
46-
self.derived_parameters: dict[str, dict] = {}
45+
self.forced_parameters: dict[str, ParDict] = {}
46+
self.derived_parameters: dict[str, ParDict] = {}
4747
self.log_loaded_file = False
4848

4949
def re_init(self, vehicle_dir: str, vehicle_type: str) -> None: # pylint: disable=too-many-branches
@@ -188,7 +188,7 @@ def compute_parameters(self, filename: str, file_info: dict, parameter_type: str
188188
continue
189189

190190
if filename not in destination:
191-
destination[filename] = {}
191+
destination[filename] = ParDict()
192192
change_reason = _(parameter_info["Change Reason"]) if parameter_info["Change Reason"] else ""
193193
destination[filename][parameter] = Par(float(result), change_reason)
194194
except (SyntaxError, NameError, KeyError, StopIteration) as _e:

ardupilot_methodic_configurator/backend_flightcontroller.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,10 +539,10 @@ def download_params(
539539
filename = "params.param"
540540
logging_warning(_("Testing active, will load all parameters from the %s file"), filename)
541541
par_dict_with_comments = ParDict.load_param_file_into_dict(filename)
542-
return {k: v.value for k, v in par_dict_with_comments.items()}, {}
542+
return {k: v.value for k, v in par_dict_with_comments.items()}, ParDict()
543543

544544
if self.master is None:
545-
return {}, {}
545+
return {}, ParDict()
546546

547547
# Check if MAVFTP is supported
548548
comport_device = getattr(self.comport, "device", "")
@@ -554,7 +554,7 @@ def download_params(
554554
return param_dict, default_param_dict
555555

556556
logging_info(_("MAVFTP is not supported by the %s flight controller, fallback to MAVLink"), comport_device)
557-
return self.__download_params_via_mavlink(progress_callback), {}
557+
return self.__download_params_via_mavlink(progress_callback), ParDict()
558558

559559
def __download_params_via_mavlink(
560560
self, progress_callback: Union[None, Callable[[int, int], None]] = None

ardupilot_methodic_configurator/data_model_configuration_step.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from ardupilot_methodic_configurator import _
1818
from ardupilot_methodic_configurator.backend_filesystem import LocalFilesystem
1919
from ardupilot_methodic_configurator.data_model_ardupilot_parameter import ArduPilotParameter
20+
from ardupilot_methodic_configurator.data_model_par_dict import ParDict
2021

2122

2223
class ConfigurationStepProcessor:
@@ -157,8 +158,8 @@ def _create_domain_model_parameters(
157158
default_par = self.local_filesystem.param_default_dict.get(param_name, None)
158159

159160
# Check if parameter is forced or derived
160-
forced_par = self.local_filesystem.forced_parameters.get(selected_file, {}).get(param_name, None)
161-
derived_par = self.local_filesystem.derived_parameters.get(selected_file, {}).get(param_name, None)
161+
forced_par = self.local_filesystem.forced_parameters.get(selected_file, ParDict()).get(param_name, None)
162+
derived_par = self.local_filesystem.derived_parameters.get(selected_file, ParDict()).get(param_name, None)
162163

163164
# Get FC value if available
164165
fc_value = fc_parameters.get(param_name)

ardupilot_methodic_configurator/frontend_tkinter_flightcontroller_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FlightControllerInfoPresenter:
2929

3030
def __init__(self, flight_controller: FlightController) -> None:
3131
self.flight_controller = flight_controller
32-
self.param_default_values: ParDict = {}
32+
self.param_default_values: ParDict = ParDict()
3333

3434
def get_info_data(self) -> dict[str, Union[str, dict[str, str]]]:
3535
"""Get formatted flight controller information for display."""

ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ def get_upload_selected_params(self, current_file: str, gui_complexity: str) ->
835835
# all parameters are selected for upload in simple mode
836836
return self.local_filesystem.file_parameters[current_file]
837837

838-
selected_params = {}
838+
selected_params = ParDict()
839839
for param_name, checkbutton_state in self.upload_checkbutton_var.items():
840840
if checkbutton_state.get():
841841
selected_params[param_name] = self.local_filesystem.file_parameters[current_file][param_name]

0 commit comments

Comments
 (0)