Skip to content

Commit

Permalink
FIX: ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Jan 11, 2025
1 parent de97374 commit 63903d5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: check-yaml

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
rev: v0.9.1
hooks:
- id: ruff
args: [ --fix ]
Expand Down
3 changes: 1 addition & 2 deletions ardupilot_methodic_configurator/backend_filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,7 @@ def add_argparse_arguments(parser: ArgumentParser) -> ArgumentParser:
type=str,
default=os_getcwd(),
help=_(
"Directory containing vehicle-specific intermediate parameter files. "
"Defaults to the current working directory"
"Directory containing vehicle-specific intermediate parameter files. Defaults to the current working directory"
),
)
parser.add_argument(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ def get_documentation_text_and_url(self, selected_file: str, prefix_key: str) ->
documentation = self.configuration_steps.get(selected_file, {}) if self.configuration_steps else None
if documentation is None:
text = _(
"File '{self.configuration_steps_filename}' not found. "
"No intermediate parameter configuration steps available"
"File '{self.configuration_steps_filename}' not found. No intermediate parameter configuration steps available"
)
text = text.format(**locals())
url = ""
Expand All @@ -206,8 +205,7 @@ def get_seq_tooltip_text(self, selected_file: str, tooltip_key: str) -> str:
documentation = self.configuration_steps.get(selected_file, {}) if self.configuration_steps else None
if documentation is None:
text = _(
"File '{self.configuration_steps_filename}' not found. "
"No intermediate parameter configuration steps available"
"File '{self.configuration_steps_filename}' not found. No intermediate parameter configuration steps available"
)
text = text.format(**locals())
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,7 @@ def main() -> None:
logging_basicConfig(level=logging_getLevelName(args.loglevel), format="%(asctime)s - %(levelname)s - %(message)s")

logging_warning(
_(
"This main is for testing and development only, usually the ConnectionSelectionWindow is called from "
"another script"
)
_("This main is for testing and development only, usually the ConnectionSelectionWindow is called from another script")
)
# pylint: enable=duplicate-code

Expand Down
14 changes: 9 additions & 5 deletions ardupilot_methodic_configurator/tempcal_imu.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,19 @@ def correction_gyro(self, imu: int, temperature: float) -> Vector3:

def param_string(self, imu: int) -> str:
params = ""
params += f"INS_TCAL{imu+1}_ENABLE 1\n"
params += f"INS_TCAL{imu+1}_TMIN {self.tmin[imu]:.1f}\n"
params += f"INS_TCAL{imu+1}_TMAX {self.tmax[imu]:.1f}\n"
params += f"INS_TCAL{imu + 1}_ENABLE 1\n"
params += f"INS_TCAL{imu + 1}_TMIN {self.tmin[imu]:.1f}\n"
params += f"INS_TCAL{imu + 1}_TMAX {self.tmax[imu]:.1f}\n"
for p in range(POLY_ORDER):
for axis in AXES:
params += f"INS_TCAL{imu+1}_ACC{p+1}_{axis} {self.acoef[imu][axis][POLY_ORDER-(p+1)]*SCALE_FACTOR:.9f}\n"
params += (
f"INS_TCAL{imu + 1}_ACC{p + 1}_{axis} {self.acoef[imu][axis][POLY_ORDER - (p + 1)] * SCALE_FACTOR:.9f}\n"
)
for p in range(POLY_ORDER):
for axis in AXES:
params += f"INS_TCAL{imu+1}_GYR{p+1}_{axis} {self.gcoef[imu][axis][POLY_ORDER-(p+1)]*SCALE_FACTOR:.9f}\n"
params += (
f"INS_TCAL{imu + 1}_GYR{p + 1}_{axis} {self.gcoef[imu][axis][POLY_ORDER - (p + 1)] * SCALE_FACTOR:.9f}\n"
)
return params


Expand Down
12 changes: 6 additions & 6 deletions unittests/backend_mavftp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ def test_decode_ftp_ack_and_nack(self) -> None:
ret = self.mav_ftp._MAVFTP__decode_ftp_ack_and_nack(case["op"]) # noqa: SLF001, pylint: disable=protected-access
ret.display_message()
log_output = self.log_stream.getvalue().strip()
assert (
case["expected_message"] in log_output
), f"Test {case['name']}: Expected {case['expected_message']} but got {log_output}"
assert case["expected_message"] in log_output, (
f"Test {case['name']}: Expected {case['expected_message']} but got {log_output}"
)
self.log_stream.seek(0)
self.log_stream.truncate(0)

Expand All @@ -249,9 +249,9 @@ def test_decode_ftp_ack_and_nack(self) -> None:
ret.error_code = 125 # Set error code to 125 to trigger unknown error message
ret.display_message()
log_output = self.log_stream.getvalue().strip()
assert (
"ListDirectory failed, unknown error 125 in display_message()" in log_output
), "Expected unknown error message for unknown error code"
assert "ListDirectory failed, unknown error 125 in display_message()" in log_output, (
"Expected unknown error message for unknown error code"
)
self.log_stream.seek(0)
self.log_stream.truncate(0)

Expand Down

0 comments on commit 63903d5

Please sign in to comment.