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

refresh sage-fixdoctests using argparse #32331

Closed
fchapoton opened this issue Aug 3, 2021 · 11 comments
Closed

refresh sage-fixdoctests using argparse #32331

fchapoton opened this issue Aug 3, 2021 · 11 comments

Comments

@fchapoton
Copy link
Contributor

see also #31366 and #32332

also full flake8 cleanup of the modified file

CC: @tscrim @slel @kliem

Component: scripts

Author: Frédéric Chapoton

Branch/Commit: 7f4b0c0

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32331

@fchapoton fchapoton added this to the sage-9.4 milestone Aug 3, 2021
@fchapoton
Copy link
Contributor Author

New commits:

7f4b0c0refresh sage-fixdoctests using argparse

@fchapoton
Copy link
Contributor Author

Branch: u/chapoton/32331

@fchapoton
Copy link
Contributor Author

Commit: 7f4b0c0

@fchapoton

This comment has been minimized.

@tscrim
Copy link
Collaborator

tscrim commented Aug 5, 2021

Reviewer: Travis Scrimshaw

@tscrim
Copy link
Collaborator

tscrim commented Aug 5, 2021

comment:4

One thing that could be considered a regression is that if I do something like

./sage --fixdoctests src/sage/combinat/q_analogues.py src/sage/combinat/rsk.py src/sage/combinat/fqsym.py

then I now get that rsk.py is an empty file, whereas the old behavior left rsk.py alone. So what we get is a new file with no output when the is erroneous input passed. There might not be a way around this because that is how argparse works, but I wanted to ask before giving the go-ahead with this.

@fchapoton
Copy link
Contributor Author

comment:5

ok, I see.

We could introduce an option -o, --output and try to handle multiple input files.

Or stay with the principle that this is to fix just one single file ?

@tscrim
Copy link
Collaborator

tscrim commented Aug 5, 2021

comment:6

I think it is fine to handle just one file, which I believe is documented. It is more if someone gives it bad input (and it realizes this) that it doesn't change any files. However, this isn't really a big deal. I think the current branch is fine, but I wanted to see if there was an easy fix to prevent this from happening.

@fchapoton
Copy link
Contributor Author

comment:7

I do not see how to distinguish between the incorrect use

sage --fixdoctests a.py b.py

where the intention is to fix both a.py and b.py inplace ; and the correct use

sage --fixdoctests a.py b.py

where the intention is to write a corrected copy of a.py in b.py.

In the second case, it could very well be that b.py is existing already, as in the first case.

I think one can reasonably keep the current behaviour, which is indeed documented.

@tscrim
Copy link
Collaborator

tscrim commented Aug 5, 2021

comment:8

I agree that we cannot distinguish between improper use and proper use. What I was saying is if someone does improper use like

sage --fixdoctests a.py b.py c.py

that b.py is not overwritten with a blank file (previously it did not). However, I doubt we can easily fix this, so I am setting this to a positive review.

@vbraun
Copy link
Member

vbraun commented Sep 5, 2021

Changed branch from u/chapoton/32331 to 7f4b0c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants