fix: remove conflicting default=True from store_true CLI flags#13
Open
octo-patch wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: remove conflicting default=True from store_true CLI flags#13octo-patch wants to merge 1 commit intomicrosoft:mainfrom
octo-patch wants to merge 1 commit intomicrosoft:mainfrom
Conversation
…icrosoft#12) --save_video in batch_infer.py and --dump_blend in scene_processor/to_blend.py both used action='store_true' combined with default=True, making them permanently enabled regardless of whether the flag was passed. Removed the redundant default=True so both flags behave as opt-in (default False).
| @@ -70,7 +70,7 @@ def main(): | |||
| parser.add_argument("--num_workers", type=int, default=0, help="Number of workers for data loading") | |||
| parser.add_argument("--output_dir", type=str, default=None, | |||
| @@ -127,8 +127,8 @@ def render_scene(camera_config: CameraConfig, output_image_path: str, output_obj | |||
| parser.add_argument('--mesh_path', type=str, | |||
| help='Path to mesh file. If not provided, a temporary directory will be used', | |||
| default=None) | |||
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.
Fixes #12
Problem
Two CLI flags use both
action='store_true'anddefault=True, which makes them permanently enabled regardless of whether the flag is passed:--save_videoinbatch_infer.py: always generates a video, even when users don't want it--dump_blendinscene_processor/to_blend.py: always saves the Blender fileWith
action='store_true', argparse already defaults the value toFalseand flips it toTrueonly when the flag is present. Thedefault=Trueoverrides this, so both flags are stuck atTrue— making them impossible to disable.Note:
--save_imgon the very next line into_blend.pycorrectly uses onlyaction='store_true'withoutdefault=True, confirming thedefault=Truevalues are unintentional.Solution
Remove the redundant
default=Truefrom both argument definitions so they behave as opt-in flags (default:False).Testing
Verified with Python's argparse: