Commit Graph
5 Commits
Author SHA1 Message Date
Peter Barker 76a39dc4df Tools: fix flake8 B008 errors, methods-in-function-definitions
e.g.

./Tools/scripts/param_check_all.py:180:40: B008 Do not perform function calls in argument defaults.  The call is performed only once at function definition time. All calls to your function will reuse the result of that definition-time function call.  If this is intended, assign the function call to a module-level variable and use that variable as a default value.
2025-10-27 11:18:20 +11:00
Peter Barker 3708936c62 global: correct shebang lines to refernce python3
also remove the odd encoding line which is not required in Py3
2025-07-22 10:45:57 +10:00
Christian Clauss 123c2efc44 Tools: Fix pytest DeprecationWarning: 'maxsplit' is passed as positional argument
```diff
- parts = re.split(r'[,=\s]+', processed_line, 1)
+ parts = re.split(r'[,=\s]+', processed_line, maxsplit=1)
```

Pytest: `DeprecationWarning: 'maxsplit' is passed as positional argument`
* https://docs.python.org/3/library/re.html#re.split

### How was this tested?
Localhost testing...
% `python -m pytest --ignore=Tools/ros2`
```
========================================== test session starts ==========================================
platform darwin -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/cclauss/Python/ardupilot
configfile: pyproject.toml
collected 53 items

Tools/autotest/unittest/annotate_params_test.py ........................                                                                                                                                                         [ 45%]
Tools/autotest/unittest/extract_param_defaults_test.py ..................                                                                                                                                                        [ 79%]
Tools/scripts/param_check_test.py ...........                                                                                                                                                                                    [100%]

========================================== warnings summary ==========================================
Tools/scripts/param_check_test.py: 118 warnings
  /Users/cclauss/Python/ardupilot/Tools/scripts/param_check.py:338: DeprecationWarning: 'maxsplit' is passed as positional argument
    parts = re.split(r'[,=\s]+', processed_line, 1)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================== 53 passed, 118 warnings in 2.74s ==========================================
```

After this change:
% `python -m pytest --ignore=Tools/ros2`
```
========================================== test session starts ==========================================
platform darwin -- Python 3.13.5, pytest-8.4.1, pluggy-1.6.0
rootdir: /Users/cclauss/Python/ardupilot
configfile: pyproject.toml
collected 53 items

Tools/autotest/unittest/annotate_params_test.py ........................                                                                                                                                                         [ 45%]
Tools/autotest/unittest/extract_param_defaults_test.py ..................                                                                                                                                                        [ 79%]
Tools/scripts/param_check_test.py ...........                                                                                                                                                                                    [100%]

========================================== 53 passed in 2.55s ==========================================
```

Also failed with `ruff check --select=B034` and passed after the proposed change.

https://docs.astral.sh/ruff/rules/re-sub-positional-args
2025-07-07 13:10:44 +10:00
Bob Long 118877ad1f Tools: param_check: fix DISABLE_CHECKS tag
This was a holdover from before I had the SkipChecks class, and I would
pass None to enable all checks.
2025-06-27 13:10:31 +10:00
Bob Long 3e56717acb Tools: add param check script 2025-06-10 22:14:13 +10:00