Skip to content
Snippets Groups Projects
Verified Commit 0a12dc75 authored by rahix's avatar rahix
Browse files

fix(pycardium): Actually enable UUID module


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent ec12a3cc
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@ python_modules = files(
'string.py',
'struct.py',
'ucontextlib.py',
'uuid.py',
)
frozen_modules = mpy_cross.process(python_modules)
......@@ -20,7 +20,7 @@ class UUID:
if len(bytes) != 16:
raise ValueError("bytes is not a 16-char string")
assert isinstance(bytes, bytes_), repr(bytes)
int = int_.from_bytes(bytes, byteorder="big")
int = int_.from_bytes(bytes, "big")
if int is not None:
if not 0 <= int < 1 << 128:
raise ValueError("int is out of range (need a 128-bit value)")
......@@ -33,7 +33,8 @@ class UUID:
# Set the version number.
int &= ~(0xF000 << 64)
int |= version << 76
self.__dict__["int"] = int
setattr(self, "int", int)
def __eq__(self, other):
if isinstance(other, UUID):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment