HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/psycopg2/__pycache__/_ipaddress.cpython-310.pyc
o


��aj�@sZdZddlmZmZmZmZmZdadaddd�Z	dd�Z
ddd	�Zdd
d�Zdd
�Z
dS)z>Implementation of the ipaddres-based network types adaptation
�)�new_type�new_array_type�
register_type�register_adapter�QuotedStringNcCsRddlatdurt�atD]}t||�q
tjtjtjtjfD]}t|t	�qdS)a
    Register conversion support between `ipaddress` objects and `network types`__.

    :param conn_or_curs: the scope where to register the type casters.
        If `!None` register them globally.

    After the function is called, PostgreSQL :sql:`inet` values will be
    converted into `~ipaddress.IPv4Interface` or `~ipaddress.IPv6Interface`
    objects, :sql:`cidr` values into into `~ipaddress.IPv4Network` or
    `~ipaddress.IPv6Network`.

    .. __: https://www.postgresql.org/docs/current/static/datatype-net-types.html
    rN)
�	ipaddress�_casters�
_make_castersr�
IPv4Interface�
IPv6Interface�IPv4Network�IPv6Networkr�adapt_ipaddress)�conn_or_curs�c�t�r�5/usr/lib/python3/dist-packages/psycopg2/_ipaddress.py�register_ipaddress%s��rcCs<tddt�}tdd|�}tddt�}tdd|�}||||gS)	N)ie�INET)izINET[])i��CIDR)i�zCIDR[])r�cast_interfacer�cast_network)�inet�ainet�cidr�acidrrrrr	Bs
r	cC�|durdSt�t|��S�N)r�ip_interface�str��s�currrrrLsrcCrr)r�
ip_networkr r!rrrrSsrcCstt|��Sr)rr )�objrrrrYsrr)�__doc__�psycopg2.extensionsrrrrrrrrr	rrrrrrr�<module>s