U
    mfB                     @   s,   d dl mZ d dlmZ G dd deZdS )    )GDALBase)rasterc                   @   s*   e Zd ZdZedd Zejdd ZdS )GDALRasterBasez@
    Attributes that exist on both GDALRaster and GDALBand.
    c                 C   s   dg}t | j}|rFd}|| }|rF||  |d7 }|| }q"t | i }|D ]t}t | j|dkrpdn| }|sqXi }d}|| }|r| d\}	}
|
||	< |d7 }|| }q|||pd< qX|S )z
        Return the metadata for this raster or band. The return value is a
        nested dictionary, where the first-level key is the metadata domain and
        the second-level is the metadata item names and values for that domain.
        DEFAULTr      N=)	capiZget_ds_metadata_domain_list_ptrappenddecodeZfree_dslZget_ds_metadataencodesplit)selfZdomain_listZ	meta_listcounterdomainresultdataZdomain_metaitemkeyval r   G/tmp/pip-unpacked-wheel-siwebuq3/django/contrib/gis/gdal/raster/base.pymetadata
   s8    	


zGDALRasterBase.metadatac                 C   s^   |  D ]P\}}|dkrdn| }|  D ]*\}}t| j| |rN| nd| q,qdS )zo
        Set the metadata. Update only the domains that are contained in the
        value dictionary.
        r   N)itemsr   r   Zset_ds_metadata_itemr	   )r   valuer   r   Z	meta_nameZ
meta_valuer   r   r   r   <   s    N)__name__
__module____qualname____doc__propertyr   setterr   r   r   r   r      s
   
1r   N)Zdjango.contrib.gis.gdal.baser   Z"django.contrib.gis.gdal.prototypesr   r   r   r   r   r   r   <module>   s   