Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Lib/uuid.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,12 @@ def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
if int is not None:
pass
elif hex is not None:
hex = hex.replace('urn:', '').replace('uuid:', '')
original_hex = hex
hex = hex.removeprefix('urn:uuid:')
hex = hex.strip('{}').replace('-', '')
if len(hex) != 32:
hex = original_hex.replace('urn:', '').replace('uuid:', '')
hex = hex.strip('{}').replace('-', '')
if len(hex) != 32:
raise ValueError('badly formed hexadecimal UUID string')
int = int_(hex, 16)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Speed up construction of :class:`uuid.UUID` from documented string formats.
Loading