CogStack / MedCAT

Medical Concept Annotation Tool
Other
456 stars 105 forks source link

CU-8695jwnjk: Fix description of an argument for --help to work in CLI #484

Closed mart-r closed 2 months ago

mart-r commented 3 months ago

Turns out the % in the description for an argument broke the argument help (i.e --help).

This PR fixes that by escaping the %.

Longer description of issue Turns out `python -m medcat.utils.regression.regression_checker --help` raises an exception due to a description having `%` in it, e.g: ``` Traceback (most recent call last): File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/Users/martratas/Documents/CogStack/.MedCAT.nosync/MedCAT/medcat/utils/regression/regression_checker.py", line 172, in args = parser.parse_args() File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 1833, in parse_args args, argv = self.parse_known_args(args, namespace) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 1866, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 2079, in _parse_known_args start_index = consume_optional(start_index) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 2019, in consume_optional take_action(action, args, option_string) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 1943, in take_action action(self, namespace, argument_values, option_string) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 1106, in __call__ parser.print_help() File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 2567, in print_help self._print_message(self.format_help(), file) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 2551, in format_help return formatter.format_help() File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 283, in format_help help = self._root_section.format_help() File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 214, in format_help item_help = join([func(*args) for func, args in self.items]) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 214, in item_help = join([func(*args) for func, args in self.items]) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 214, in format_help item_help = join([func(*args) for func, args in self.items]) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 214, in item_help = join([func(*args) for func, args in self.items]) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 540, in _format_action help_text = self._expand_help(action) File "/Users/martratas/.pyenv/versions/3.10.13/lib/python3.10/argparse.py", line 637, in _expand_help return self._get_help_string(action) % params ValueError: unsupported format character ')' (0x29) at index 129 ```
tomolopolis commented 3 months ago

Task linked: CU-8695jwnjk Fix regression suite help