Upgrade --save - #57
Merged
Merged
Conversation
argparse only converts ArgumentTypeError inside its own type= conversion, so one raised in an Action escaped as a traceback. Affected every multi-arg adaptor. Co-Authored-By: Claude <noreply@anthropic.com>
Needed as a public predicate by parse_save, which must detect whether an arg is a key=value attempt without raising. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
--save now absorbs --save-format as format=, and gains dir=/name= plus a bare '[dir/][stem][.ext]' fragment. --save-dpi is untouched, pending a --dpi that would also apply to live figures. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
bash leaves ~ alone after a '=' (dir=~/figs) and inside quotes, so without this the save dir was a literal '~' directory that mkdir(parents=True) then created. A dir legitimately named '~foo' stays literal: expanduser() raises RuntimeError for an unknown user rather than passing it through like os.path.expanduser. Co-Authored-By: Claude <noreply@anthropic.com>
Matches argparse's own _get_action_name, which joins option_strings in registration order. The reversal only existed to satisfy a test that pinned the order; that test now asserts order-agnostically. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Save had grown four test files across two layers. Now one file in three sections: the parse_save grammar, the derived filename stem, and end-to-end pipeline saves. No test content changed. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upgrade
--save. It now:.), then the name/stem, then the dir.dir=<dir>,name=<name>, andformat=<format>.Remove
--save-format.Note that this is a breaking change:
-s dir(literally "dir") will now createdir.png/dir.mp4in the current working directory instead ofdir/<autogenerated stem>.<ext>. To achieve the previous behavior, append a / to the end of directories, e.g.-s dir/, or use-s dir=dir.Here's a helpful diagram of behavior:
-sargumentsout/outfigfig.gifgiffig.giffiggifout/.gifoutgifout/fig.gifoutfiggif.../.../..dir=out name=fig format=gifoutfiggifname=fig.ifig.iNote that the default dir is
., default name is automatically generated, and default format is determined by the plot type.