o
    
h                     @   s`   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z
 d dlmZmZ G dd deZd	S )
    )c_void_p)GDALBase)GDALException)ds)raster)force_bytes	force_strc                
   @   s\   e Zd ZdZdddddddddd	Zdd Zd	d
 Zedd Zedd Z	e
dd ZdS )Driverz
    Wrap a GDAL/OGR Data Source Driver.
    For more information, see the C API documentation:
    https://gdal.org/api/vector_c_api.html
    https://gdal.org/api/raster_c_api.html
    zESRI ShapefileTIGERGTiffJPEG)	esrishpshapetigerz
tiger/linetifftifjpegjpgc                 C   s   t |tr/|   | | jv r| j|  }n|}ttfD ]}t|t	|}|r- nqn*t |t
rI|   ttfD ]}||}|rG nq<nt |trQ|}ntdt| |satd| || _dS )zT
        Initialize an GDAL/OGR driver on either a string or integer input.
        z/Unrecognized input type for GDAL/OGR Driver: %sz1Could not initialize GDAL/OGR Driver on input: %sN)
isinstancestrensure_registeredlower_aliasvcapircapir   get_driver_by_namer   int
get_driverr   typeptr)selfdr_inputnameifacedriver r&   `/var/www/html/optinet_system/venv/lib/python3.10/site-packages/django/contrib/gis/gdal/driver.py__init__$   s:   





zDriver.__init__c                 C   s   | j S )N)r#   r!   r&   r&   r'   __str__L   s   zDriver.__str__c                 C   s(   t  st   t st  dS dS )zB
        Attempt to register all the data source drivers.
        N)r   get_driver_countregister_allr   clsr&   r&   r'   r   O   s
   zDriver.ensure_registeredc                 C   s   t  t  S )zO
        Return the number of GDAL/OGR data source drivers registered.
        )r   r+   r   r-   r&   r&   r'   driver_count[      zDriver.driver_countc                 C   s   t t| jS )zA
        Return description/name string for this driver.
        )r   r   get_driver_descriptionr    r)   r&   r&   r'   r#   b   r0   zDriver.nameN)__name__
__module____qualname____doc__r   r(   r*   classmethodr   r/   propertyr#   r&   r&   r&   r'   r	   
   s(    (

r	   N)ctypesr   django.contrib.gis.gdal.baser   django.contrib.gis.gdal.errorr   "django.contrib.gis.gdal.prototypesr   r   r   r   django.utils.encodingr   r   r	   r&   r&   r&   r'   <module>   s    