
    Hwg                     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)ds)raster)force_bytes	force_strc            
       d    e Zd ZdZdddddddddd	Z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TIGERGTiffJPEG)	esrishpshapetigerz
tiger/linetifftifjpegjpgc                 >   t        |t              r| j                          |j                         | j                  v r| j                  |j                            }n|}t
        t        fD ])  }t        |j                  t        |                  }|s) ns nqt        |t              r7| j                          t
        t        fD ]  }|j                  |      }|s n, 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_aliasvcapircapir   get_driver_by_namer   int
get_driverr   typeptr)selfdr_inputnameifacedrivers        U/var/www/horilla/myenv/lib/python3.12/site-packages/django/contrib/gis/gdal/driver.py__init__zDriver.__init__$   s    h$""$ ~~4;;.{{8>>#34   !%":":;t;L"MN #&""$ ))(3 (+FADNR 
 ChN      c                     | j                   S )N)r&   r$   s    r)   __str__zDriver.__str__L   s    yyr+   c                     t        j                         st        j                          t        j                         st        j                          yy)zB
        Attempt to register all the data source drivers.
        N)r   get_driver_countregister_allr   clss    r)   r   zDriver.ensure_registeredO   s9     %%' %%'  (r+   c                 T    t        j                         t        j                         z   S )zO
        Return the number of GDAL/OGR data source drivers registered.
        )r   r0   r   r2   s    r)   driver_countzDriver.driver_count[   s!    
 %%'%*@*@*BBBr+   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.nameb   s    
 55dhh?@@r+   N)__name__
__module____qualname____doc__r   r*   r.   classmethodr   r5   propertyr&    r+   r)   r   r   
   sv     !!F&P 	! 	! C C A Ar+   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)   <module>rD      s'     1 7 : > 8]AX ]Ar+   