/usr/local/lib/python3.9/site-packages/django/contrib/gis/db/backends/postgis/__pycache__
a Ӱ�h� � @ s: d Z ddlmZ ddlmZ ddlmZ G dd� d�ZdS )zL This object provides quoting for GEOS geometries into PostgreSQL/PostGIS. � )�to_pgraster)�GEOSGeometry)�sqlc @ sJ e Zd Zddd�Zdd� Zdd� Zdd � Zd d� Zedd � �Z dd� Z dS )�PostGISAdapterFc C s@ t |ttf�| _| jr$t|j�| _n t|�| _|j| _|| _dS )z3 Initialize on the spatial object. N) � isinstancer r �is_geometry�bytes�ewkbr Zsrid� geography)�self�objr � r �X/usr/local/lib/python3.9/site-packages/django/contrib/gis/db/backends/postgis/adapter.py�__init__ s zPostGISAdapter.__init__c C s$ ddl m} ||kr| S td��dS )z9Does the given protocol conform to what Psycopg2 expects?r )� ISQLQuotez<Error implementing psycopg2 protocol. Is psycopg2 installed?N)Zpsycopg2.extensionsr � Exception)r �protor r r r �__conform__ s �zPostGISAdapter.__conform__c C s t |t�o| j|jkS �N)r r r )r �otherr r r �__eq__% s zPostGISAdapter.__eq__c C s t | j�S r )�hashr �r r r r �__hash__( s zPostGISAdapter.__hash__c C s | � � �� S r )� getquoted�decoder r r r �__str__+ s zPostGISAdapter.__str__c C s |S r r )�clsZpolyr r r �_fix_polygon. s zPostGISAdapter._fix_polygonc C s>