Skip to content

Commit d73fe28

Browse files
committed
FIX: all current linter issues
1 parent cc42993 commit d73fe28

15 files changed

+28
-27
lines changed

.github/workflows/mypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
- name: Install dependencies
2323
run: |
24-
python -m pip install -U mypy
24+
python -m pip install -U mypy types-requests
2525
2626
- name: Lint the code with mypy
2727
uses: sasanquaneuf/mypy-github-action@releases/v1.3

.github/workflows/pylint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install dependencies
3030
run: |
3131
python -m pip install --upgrade pip
32-
pip install 'pylint<=3.2.7'
32+
pip install 'pylint>=3.3.1'
3333
3434
- name: Analysing the code with pylint
3535
run: |

MethodicConfigurator/annotate_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def load_param_file_into_dict(param_file: str) -> dict[str, "Par"]:
184184
return parameter_dict
185185

186186
@staticmethod
187-
def validate_parameter(param_file, parameter_dict, i, original_line, comment, parameter, value) -> None: # pylint: disable=too-many-arguments
187+
def validate_parameter(param_file, parameter_dict, i, original_line, comment, parameter, value) -> None: # pylint: disable=too-many-arguments, too-many-positional-arguments
188188
if len(parameter) > PARAM_NAME_MAX_LEN:
189189
raise SystemExit(f"Too long parameter name: {parameter} in {param_file} line {i}")
190190
if not re.match(PARAM_NAME_REGEX, parameter):
@@ -639,7 +639,7 @@ def update_parameter_documentation(
639639
)
640640

641641

642-
def update_parameter_documentation_file( # pylint: disable=too-many-locals, too-many-arguments
642+
def update_parameter_documentation_file( # pylint: disable=too-many-locals, too-many-arguments, too-many-positional-arguments
643643
doc,
644644
sort_type,
645645
param_default_dict,

MethodicConfigurator/backend_filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from typing import Any, Optional
2626
from zipfile import ZipFile
2727

28-
from requests import get as requests_get # type: ignore[import-untyped]
28+
from requests import get as requests_get
2929

3030
from MethodicConfigurator import _
3131
from MethodicConfigurator.annotate_params import (

MethodicConfigurator/backend_filesystem_configuration_steps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def __validate_parameters_in_configuration_steps(self, filename: str, file_info:
112112
parameter,
113113
)
114114

115-
def compute_parameters(self, filename: str, file_info: dict, parameter_type: str, variables: dict) -> str:
115+
def compute_parameters(self, filename: str, file_info: dict, parameter_type: str, variables: dict) -> str: # pylint: disable=too-many-branches
116116
"""
117117
Computes the forced or derived parameters for a given configuration file.
118118
@@ -122,7 +122,7 @@ def compute_parameters(self, filename: str, file_info: dict, parameter_type: str
122122
if parameter_type + "_parameters" not in file_info or not variables:
123123
return ""
124124
destination = self.forced_parameters if parameter_type == "forced" else self.derived_parameters
125-
for parameter, parameter_info in file_info[parameter_type + "_parameters"].items():
125+
for parameter, parameter_info in file_info[parameter_type + "_parameters"].items(): # pylint: disable=too-many-nested-blocks
126126
try:
127127
if ("fc_parameters" in str(parameter_info["New Value"])) and (
128128
"fc_parameters" not in variables or variables["fc_parameters"] == {}

MethodicConfigurator/backend_filesystem_program_settings.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __user_config_dir() -> str:
100100
error_msg = _("The path '{user_config_directory}' is not a directory.")
101101
raise NotADirectoryError(error_msg.format(**locals()))
102102

103-
return user_config_directory
103+
return user_config_directory # type: ignore[no-any-return] # workaround a mypy bug
104104

105105
@staticmethod
106106
def __site_config_dir() -> str:
@@ -115,7 +115,7 @@ def __site_config_dir() -> str:
115115
error_msg = _("The path '{site_config_directory}' is not a directory.")
116116
raise NotADirectoryError(error_msg.format(**locals()))
117117

118-
return site_config_directory
118+
return site_config_directory # type: ignore[no-any-return] # workaround a mypy bug
119119

120120
@staticmethod
121121
def __get_settings_as_dict() -> dict[str, Any]:
@@ -250,7 +250,8 @@ def set_display_usage_popup(ptype: str, value: bool) -> None:
250250
@staticmethod
251251
def get_setting(setting: str) -> Union[int, bool]:
252252
if setting in SETTINGS_DEFAULTS:
253-
return ProgramSettings.__get_settings_as_dict().get(setting, SETTINGS_DEFAULTS[setting]) # type: ignore[no-any-return]
253+
setting_default = SETTINGS_DEFAULTS[setting]
254+
return ProgramSettings.__get_settings_as_dict().get(setting, setting_default) # type: ignore[no-any-return]
254255
return False
255256

256257
@staticmethod

MethodicConfigurator/backend_mavftp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class FTP_OP: # pylint: disable=invalid-name, too-many-instance-attributes
8686
including the necessary parameters and payload for the operation.
8787
"""
8888

89-
def __init__( # pylint: disable=too-many-arguments
89+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
9090
self,
9191
seq,
9292
session,
@@ -216,7 +216,7 @@ def __setattr__(self, name, value) -> None:
216216
class MAVFTPReturn:
217217
"""The result of a MAVFTP operation."""
218218

219-
def __init__( # pylint: disable=too-many-arguments
219+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
220220
self,
221221
operation_name: str,
222222
error_code: int,
@@ -1348,7 +1348,7 @@ def save_params(
13481348
f.write("\n")
13491349
logging.info("Outputted %u parameters to %s", len(pdict), filename)
13501350

1351-
def cmd_getparams( # pylint: disable=too-many-arguments
1351+
def cmd_getparams( # pylint: disable=too-many-arguments, too-many-positional-arguments
13521352
self,
13531353
args,
13541354
progress_callback=None,

MethodicConfigurator/frontend_tkinter_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class ProgressWindow:
217217
a task. It includes a progress bar and a label to display the progress message.
218218
"""
219219

220-
def __init__(self, parent, title: str, message: str = "", width: int = 300, height: int = 80) -> None: # pylint: disable=too-many-arguments
220+
def __init__(self, parent, title: str, message: str = "", width: int = 300, height: int = 80) -> None: # pylint: disable=too-many-arguments, too-many-positional-arguments
221221
self.parent = parent
222222
self.message = message
223223
self.progress_window = tk.Toplevel(self.parent)
@@ -384,7 +384,7 @@ def put_image_in_label(parent: ttk.Frame, filepath: str, image_height: int = 40)
384384
photo = ImageTk.PhotoImage(resized_image)
385385

386386
# Create a label with the resized image
387-
image_label = ttk.Label(parent, image=photo) # type: ignore[arg-type]
387+
image_label = ttk.Label(parent, image=photo)
388388
# Keep a reference to the image to prevent it from being garbage collected
389389
image_label.image = photo # type: ignore
390390
return image_label
@@ -406,7 +406,7 @@ def should_display(ptype: str) -> bool:
406406
return ProgramSettings.display_usage_popup(ptype)
407407

408408
@staticmethod
409-
def display( # pylint: disable=too-many-arguments
409+
def display( # pylint: disable=too-many-arguments, too-many-positional-arguments
410410
parent: tk.Toplevel,
411411
usage_popup_window: BaseWindow,
412412
title: str,

MethodicConfigurator/frontend_tkinter_component_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ def validate_combobox(self, event: tk.Event, path: tuple[str, ...]) -> bool:
617617
combobox.configure(style="comb_input_valid.TCombobox")
618618
return True
619619

620-
def validate_entry_limits(self, event, entry, data_type, limits, _name, path) -> bool: # pylint: disable=too-many-arguments
620+
def validate_entry_limits(self, event, entry, data_type, limits, _name, path) -> bool: # pylint: disable=too-many-arguments, too-many-positional-arguments
621621
is_focusout_event = event and event.type == "10"
622622
try:
623623
value = entry.get() # make sure value is defined to prevent exception in the except block

MethodicConfigurator/frontend_tkinter_connection_selection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ConnectionSelectionWidgets: # pylint: disable=too-many-instance-attribute
3232
allowing the user to select a connection, and handling the connection process.
3333
"""
3434

35-
def __init__( # pylint: disable=too-many-arguments
35+
def __init__( # pylint: disable=too-many-arguments, too-many-positional-arguments
3636
self,
3737
parent,
3838
parent_frame,

0 commit comments

Comments
 (0)