Skip to content

Commit 26287b9

Browse files
committed
IMPROVEMENT: annotate_params.py Fix magfit xml documentation filename
small NFC lint improvements
1 parent 89b1da1 commit 26287b9

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

MethodicConfigurator/annotate_params.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import glob
2929
import re
3030
from sys import exc_info as sys_exc_info
31+
from sys import exit as sys_exit
3132
from typing import Any, Dict, List, Optional, Tuple
3233
import xml.etree.ElementTree as ET
3334
import argparse
@@ -37,7 +38,7 @@
3738
BASE_URL = "https://autotest.ardupilot.org/Parameters/"
3839

3940
PARAM_DEFINITION_XML_FILE = "apm.pdef.xml"
40-
LUA_PARAM_DEFINITION_XML_FILE = "22_inflight_magnetometer_fit_setup.pdef.xml"
41+
LUA_PARAM_DEFINITION_XML_FILE = "24_inflight_magnetometer_fit_setup.pdef.xml"
4142

4243
# ArduPilot parameter names start with a capital letter and can have capital letters, numbers and _
4344
PARAM_NAME_REGEX = r'^[A-Z][A-Z_0-9]*'
@@ -58,20 +59,20 @@ def arg_parser():
5859
parser.add_argument('-s', '--sort',
5960
choices=['none', 'missionplanner', 'mavproxy'],
6061
default='none',
61-
help='Sort the parameters in the file. Defaults to not sorting.',
62+
help='Sort the parameters in the file. Defaults to %(default)s.',
6263
)
6364
parser.add_argument('-t', '--vehicle-type',
6465
choices=['AP_Periph', 'AntennaTracker', 'ArduCopter', 'ArduPlane',
6566
'ArduSub', 'Blimp', 'Heli', 'Rover', 'SITL'],
6667
default='ArduCopter',
67-
help='The type of the vehicle. Defaults to ArduCopter',
68+
help='The type of the vehicle. Defaults to %(default)s.',
6869
)
6970
parser.add_argument('-m', '--max-line-length',
7071
type=int, default=100,
71-
help='Maximum documentation line length. Defaults to %(default)s',
72+
help='Maximum documentation line length. Defaults to %(default)s.',
7273
)
7374
parser.add_argument('--verbose', action='store_true',
74-
help='Increase output verbosity, print ReadOnly parameter list. Defaults to %(default)s',
75+
help='Increase output verbosity, print ReadOnly parameter list. Defaults to %(default)s.',
7576
)
7677
parser.add_argument('-v', '--version', action='version', version=f'%(prog)s {VERSION}',
7778
help='Display version information and exit.',
@@ -313,12 +314,12 @@ def get_xml_data(base_url: str, directory: str, filename: str) -> ET.Element:
313314
else:
314315
# No locally cached file exists, get it from the internet
315316
try:
316-
from requests import get as requests_get # pylint: disable=C0415
317-
from requests import exceptions as requests_exceptions # pylint: disable=C0415
318-
except ImportError:
317+
from requests import get as requests_get # pylint: disable=import-outside-toplevel
318+
from requests import exceptions as requests_exceptions # pylint: disable=import-outside-toplevel
319+
except ImportError as exc:
319320
logging.critical("The requests package was not found")
320321
logging.critical("Please install it by running 'pip install requests' in your terminal.")
321-
raise SystemExit("requests package is not installed") # pylint: disable=W0707
322+
raise SystemExit("requests package is not installed") from exc
322323
try:
323324
# Send a GET request to the URL
324325
response = requests_get(base_url + filename, timeout=5)
@@ -664,7 +665,7 @@ def main():
664665
args.sort, param_default_dict, args.delete_documentation_annotations)
665666
except Exception as exp: # pylint: disable=W0718
666667
logging.fatal(exp)
667-
exit(1) # pylint: disable=R1722
668+
sys_exit(1)
668669

669670

670671
if __name__ == "__main__":

0 commit comments

Comments
 (0)