Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

mart-r
Copy link
Collaborator

@mart-r mart-r commented Aug 30, 2024

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 <module>
    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 <listcomp>
    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 <listcomp>
    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
Copy link
Member

Task linked: CU-8695jwnjk Fix regression suite help

Copy link
Member

@tomolopolis tomolopolis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mart-r mart-r merged commit b28fa05 into master Sep 2, 2024
8 checks passed
@mart-r mart-r deleted the CU-8695jwnjk-regression-checker-cli-help branch November 18, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants