aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py
diff options
context:
space:
mode:
authorS. Solomon Darnell2025-03-28 21:52:21 -0500
committerS. Solomon Darnell2025-03-28 21:52:21 -0500
commit4a52a71956a8d46fcb7294ac71734504bb09bcc2 (patch)
treeee3dc5af3b6313e921cd920906356f5d4febc4ed /.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py
parentcc961e04ba734dd72309fb548a2f97d67d578813 (diff)
downloadgn-ai-master.tar.gz
two version of R2R are hereHEADmaster
Diffstat (limited to '.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py')
-rw-r--r--.venv/lib/python3.12/site-packages/psycopg_binary/_uuid.py28
1 files changed, 28 insertions, 0 deletions
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