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

Replace optparse with argparse in suite_report.py #34

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

t00sa
Copy link

@t00sa t00sa commented Aug 12, 2024

The only script using optparse was suite_report.py. This has been updated to use argparse and the script has been linted and its compliance with flake8 improved.

A before and after comparison of the output from suite_report.py shows no change in behaviour:

vdi> python suite_report.py -S ~/cylc-run/vn13.6_remove_optparse/runN/ -L /var/tmp
svn://fcm1/monc.xm_svn/casim/trunk appears to be the trunk, nothing to do!
svn://fcm1/jules.xm_svn/main/trunk appears to be the trunk, nothing to do!
svn://fcm1/moci.xm_svn/main/trunk appears to be the trunk, nothing to do!
svn://fcm1/um.xm_svn/mule/trunk appears to be the trunk, nothing to do!
svn://fcm1/utils.xm_svn/shumlib/trunk appears to be the trunk, nothing to do!
svn://fcm1/socrates.xm_svn/main/trunk appears to be the trunk, nothing to do!
svn://fcm1/ukca.xm_svn/main/trunk appears to be the trunk, nothing to do!
svn://fcm1/um.xm_svn/aux/trunk appears to be the trunk, nothing to do!
svn://fcm1/um.xm_svn/meta/trunk appears to be the trunk, nothing to do!
vdi> diff /var/tmp/trac.log ~/cylc-run/vn13.6_remove_optparse/runN/trac.log 
7c7
<  || Report Generated: || 2024/08/12 20:34:02 || 
---
>  || Report Generated: || 2024/08/12 13:53:01 ||
vdi> 

See also: UM ticket 7722

Remove the deprecated optparse module and replace it with an similar
implementation using argparse.
Find and fix various problems reported by pylint.
Fixes everything but a single case where the options are either an
E129 warning about having the same indentation as the next line or an
E127 warning about over-indentation - and there doesn't seem to be a
format that satisfies the checker!
@t00sa t00sa linked an issue Aug 12, 2024 that may be closed by this pull request
Enable command line argument completion for the two directory options
if/when argcomplete is available.
To keep the linter happy, most of the format() calls with f-strings.
This supposedly offers better performance and is more in keeping with
python 3.
@t00sa t00sa requested review from a team and ericaneininger and removed request for a team August 27, 2024 07:22
Copy link
Contributor

@ericaneininger ericaneininger left a comment

Choose a reason for hiding this comment

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

A couple of comments/queries in-line.

suite_report.py Show resolved Hide resolved
suite_report.py Show resolved Hide resolved
suite_report.py Show resolved Hide resolved
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.

Replace optparse with argparse in scripts
2 participants