-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-128427: Add uuid.NIL and uuid.MAX
#128429
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
50c6294
Add `uuid.NIL` and `uuid.MAX`
ngnpope fc14200
Edits to documentation
ngnpope 8b71df2
Edits to tests
ngnpope 2fde894
More tweaks to test assertions
ngnpope ecf263a
Add comments to test assertions
ngnpope cba80bc
Empty commit to retrigger CI
ngnpope bf61ffe
Remove extra links
ngnpope File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -289,6 +289,25 @@ of the :attr:`~UUID.variant` attribute: | |||||
| Reserved for future definition. | ||||||
|
|
||||||
|
|
||||||
| The :mod:`uuid` module defines the special Nil and Max UUID values: | ||||||
|
|
||||||
|
|
||||||
| .. data:: NIL | ||||||
|
|
||||||
| A special form of UUID that is specified to have all 128 bits set to zero | ||||||
| according to :rfc:`RFC 9562, §5.9 <9562#section-5.9>`. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Linking directly to the section is helpful, perhaps we only need to mention the RFC number here? If so, we could update the same thing for
Suggested change
|
||||||
|
|
||||||
| .. versionadded:: next | ||||||
|
|
||||||
|
|
||||||
| .. data:: MAX | ||||||
|
|
||||||
| A special form of UUID that is specified to have all 128 bits set to one | ||||||
| according to :rfc:`RFC 9562, §5.10 <9562#section-5.10>`. | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
| .. versionadded:: next | ||||||
|
|
||||||
|
|
||||||
| .. seealso:: | ||||||
|
|
||||||
| :rfc:`9562` - A Universally Unique IDentifier (UUID) URN Namespace | ||||||
|
|
@@ -380,6 +399,14 @@ Here are some examples of typical usage of the :mod:`uuid` module:: | |||||
| >>> uuid.UUID(bytes=x.bytes) | ||||||
| UUID('00010203-0405-0607-0809-0a0b0c0d0e0f') | ||||||
|
|
||||||
| >>> # get the Nil UUID | ||||||
| >>> uuid.NIL | ||||||
| UUID('00000000-0000-0000-0000-000000000000') | ||||||
|
|
||||||
| >>> # get the Max UUID | ||||||
| >>> uuid.MAX | ||||||
| UUID('ffffffff-ffff-ffff-ffff-ffffffffffff') | ||||||
ngnpope marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
|
|
||||||
| .. _uuid-cli-example: | ||||||
|
|
||||||
|
|
||||||
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
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
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
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
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2025-01-02-20-34-04.gh-issue-128427.onPoQZ.rst
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| :const:`uuid.NIL` and :const:`uuid.MAX` are now available to represent the Nil | ||
| and Max UUID formats as defined by :rfc:`9562`. |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.