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

Fix help message formatting for validateDrpy.py #29

Merged
merged 2 commits into from Jan 20, 2017
Merged

Conversation

wmwv
Copy link
Contributor

@wmwv wmwv commented Jan 6, 2017

Pass formatter_class=argparse.RawDescriptionHelpFormatter to
argparse.AggumentParser.

Copy link
Contributor

@jonathansick jonathansick left a comment

Choose a reason for hiding this comment

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

This looks like a very useful change.

The only optional improvement is to note that using the triple double-quotes, with the contents indented to the function scope, means that the help message is intended by four spaces.

A way to get around that is to assemble the help text line by line:

description = \
    'Calculate and plot validation Key Project Metrics from the LSST SRD.' \
    'http://ls.st/LPM-17\n' \
    'Produces results to:' \
    'STDOUT' \
    '    Summary of key metrics' \
    'REPONAME*.png' \
    '    Plots of key metrics.  Generated in current working directory.' \
    'REPONAME*.json' \
    '    JSON serialization of each KPM.' \
    'where REPONAME is based on the repository name but with path separators' \
    'replaced with underscores.  E.g., "Cfht/output" -> "Cfht_output_"' \

or maybe a saner approach is to make description a global level variable, outside the function scope (this is a script after all, so it's cool, and then the triple double-quotes won't introduce any unintentional indents.

Pass formatter_class=argparse.RawDescriptionHelpFormatter to
argparse.AggumentParser.
Move the definition of the description variable out of the
'if __name__=="__main_"' block for cleaner formatting of the whitespace.
@wmwv wmwv merged commit fa89509 into master Jan 20, 2017
@wmwv
Copy link
Contributor Author

wmwv commented Jan 20, 2017

Thanks for the suggestion. I've moved the description definition up to global scope for this script.

@ktlim ktlim deleted the tickets/DM-8933 branch August 25, 2018 06:50
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.

None yet

2 participants