gh-148740: Allow setting namespace from command line usage of uuid module#148741
Open
sumpygump wants to merge 1 commit intopython:mainfrom
Open
gh-148740: Allow setting namespace from command line usage of uuid module#148741sumpygump wants to merge 1 commit intopython:mainfrom
sumpygump wants to merge 1 commit intopython:mainfrom
Conversation
- This applies to generating version 3 and 5 UUIDs - Will correctly bail when invalid UUID is supplied as namespace
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.
Example usage with correction:
./python -m uuid --uuid uuid5 --namespace '0d6a16cc-34a7-47d8-b660-214d0ae184d2' --name some.user a32f4562-2058-5b20-8055-5f38b28285b6Example error if invalid UUID is supplied as
--namespaceargument:My solution was to update the argparse options to use
metavarinstead ofchoicesfor the namespaceargument. This allows to supply suggestions of options that can be supplied for the
--namespacearguments instead of requiring ONLY the ones in the list.My intent was to keep the help message consistent with how it looked before. Note that it still displays the possible values in the help text for the namespace:
-n, --namespace {any UUID,@dns,@url,@oid,@x500}:uuidmodule doesn't allow to supply custom namespace UUID #148740