
    _?iR                     f    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e      Zy	)
    )c_void_p)GDALBase)GDALException)GDAL_VERSION)ds)force_bytes	force_strc                       e Zd ZdZddddddddZedd dk  rej                  d	d	d
       d Zd Ze	d        Z
e	d        Zed        Zy)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GTiffJPEG)esrishpshapetifftifjpegjpgN   )   
   TIGER)tigerz
tiger/linec                    t        |t              rt| j                          |j                         | j                  v r| j                  |j                            }n|}t        t        j                  t        |                  }n`t        |t              r&| j                          t        j                  |      }n*t        |t
              r|}nt        dt        |      z        |st        d|z        || _        y)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_aliasr   capiget_driver_by_namer   int
get_driverr   typeptr)selfdr_inputnamedrivers       p/home/cursorai/projects/django-cronjob-utils/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/driver.py__init__zDriver.__init__*   s     h$""$ ~~4;;.{{8>>#34 d55k$6GHIF#&""$__X.F(+FADNR 
 ChN      c                     | j                   S )N)r(   r&   s    r*   __str__zDriver.__str__L   s    yyr,   c                 V    t        j                         st        j                          yy)zB
        Attempt to register all the data source drivers.
        N)r    get_driver_countregister_allclss    r*   r   zDriver.ensure_registeredO   s!     $$& 'r,   c                 *    t        j                         S )zO
        Return the number of GDAL/OGR data source drivers registered.
        )r    r1   r3   s    r*   driver_countzDriver.driver_countY   s    
 $$&&r,   c                 R    t        t        j                  | j                              S )zA
        Return description/name string for this driver.
        )r	   r    get_driver_descriptionr%   r.   s    r*   r(   zDriver.name`   s    
 44TXX>??r,   )__name__
__module____qualname____doc__r   r   updater+   r/   classmethodr   r6   propertyr(    r,   r*   r   r   
   s     !!
F BQ7" %	
 D     ' ' @ @r,   r   N)ctypesr   django.contrib.gis.gdal.baser   django.contrib.gis.gdal.errorr   django.contrib.gis.gdal.libgdalr   "django.contrib.gis.gdal.prototypesr   r    django.utils.encodingr   r	   r   r@   r,   r*   <module>rG      s'     1 7 8 9 8[@X [@r,   