HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/aigenerator/venv/lib/python3.12/site-packages/psycopg/_cmodule.py
"""
Simplify access to the _psycopg module
"""

# Copyright (C) 2021 The Psycopg Team

from __future__ import annotations

from . import pq

__version__: str | None = None

# Note: "c" must the first attempt so that mypy associates the variable the
# right module interface. It will not result Optional, but hey.
if pq.__impl__ == "c":
    from psycopg_c import _psycopg as _psycopg
    from psycopg_c import __version__ as __version__  # noqa: F401
elif pq.__impl__ == "binary":
    from psycopg_binary import _psycopg as _psycopg  # type: ignore
    from psycopg_binary import __version__ as __version__  # type: ignore  # noqa: F401
elif pq.__impl__ == "python":
    _psycopg = None  # type: ignore
else:
    raise ImportError(f"can't find _psycopg optimised module in {pq.__impl__!r}")