U ¡Ï aj ã@sZdZddlmZmZmZmZmZdadaddd„Z dd„Z ddd „Z dd d „Z d d „Z dS)z>Implementation of the ipaddres-based network types adaptation é)Únew_typeÚnew_array_typeÚ register_typeÚregister_adapterÚ QuotedStringNcCsRddlatdkrtƒatD]}t||ƒqtjtjtjtjfD]}t|t ƒq>dS)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)Z conn_or_cursÚcÚt©rúTC:\Users\vtejo\AppData\Local\Temp\pip-unpacked-wheel-8c51wohf\psycopg2\_ipaddress.pyÚregister_ipaddress%s ÿrcCs<tddtƒ}tdd|ƒ}tddtƒ}tdd|ƒ}||||gS) N)ieZINET)izINET[])iŠZCIDR)i‹zCIDR[])rÚcast_interfacerÚ cast_network)ZinetZainetZcidrZacidrrrrr Bs     r cCs|dkr dSt t|ƒ¡S©N)rÚ ip_interfaceÚstr©ÚsÚcurrrrrLsrcCs|dkr dSt t|ƒ¡Sr)rÚ ip_networkrrrrrrSsrcCs tt|ƒƒSr)rr)ÚobjrrrrYsr)N)N)N)Ú__doc__Zpsycopg2.extensionsrrrrrrrrr rrrrrrrÚs