From 4a52a71956a8d46fcb7294ac71734504bb09bcc2 Mon Sep 17 00:00:00 2001 From: S. Solomon Darnell Date: Fri, 28 Mar 2025 21:52:21 -0500 Subject: two version of R2R are here --- .../site-packages/psycopg_binary/_uuid.py | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py (limited to '.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py') diff --git a/.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py b/.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py new file mode 100644 index 00000000..ec6b5338 --- /dev/null +++ b/.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py @@ -0,0 +1,28 @@ +""" +Internal objects to support the UUID adapters. +""" + +# Copyright (C) 2025 The Psycopg Team + +import uuid + +# Re-exports +UUID = uuid.UUID +SafeUUID_unknown = uuid.SafeUUID.unknown + + +class _WritableUUID(UUID): + """Temporary class, with the same memory layout of UUID, but writable. + + This class must have the same memory layout of the UUID class, so we can + create one, setting the `int` attribute, and changing the `__class__`, + which should be faster than calling the complex UUID.__init__ machinery. + + u = _WritableUUID() + u.is_safe = ... + u.int = ... + u.__class__ = UUID + """ + + __slots__ = () # Give the class the same memory layout of the base clasee + __setattr__ = object.__setattr__ # make the class writable -- cgit v1.2.3