o
    ˳i	                     @   sP   d dl mZmZmZ d dlmZmZ edZedZG dd deeef Z	dS )    )IteratorMappingSequence)TypeVarcastKVc                   @   s   e Zd ZdZdZdeeeeB   fddZde	eef fddZ
d	edefd
dZdee fddZdefddZde	eef fddZdS )LazyDictz1Lazily build a dictionary from an array of items.	_contents_dictcontentsc                 C   s   || _ d | _d S )Nr
   )selfr    r   L/home/ubuntu/.local/lib/python3.10/site-packages/pyiceberg/utils/lazydict.py__init__'   s   
zLazyDict.__init__returnc                 C   sZ   i | _ | jD ]#}| j ttttt |d d d ttt |dd d dd q| j S )N      T)strict)	r   r   updatedictzipr   r   r   r   )r   itemr   r   r   _build_dict+   s   
DzLazyDict._build_dictkeyc                C   s   | j p|  }|| S )z#Return the value for the given key.r   r   )r   r   sourcer   r   r   __getitem__2      zLazyDict.__getitem__c                 C      | j p|  }t|S )z3Return an iterator over the keys of the dictionary.)r   r   iterr   r   r   r   r   __iter__7   r   zLazyDict.__iter__c                 C   r    )z-Return the number of items in the dictionary.)r   r   lenr"   r   r   r   __len__<   r   zLazyDict.__len__c                 C   s   | j p|  S )z Convert the lazy dict in a dict.r   )r   r   r   r   __dict__A   s   zLazyDict.__dict__N)__name__
__module____qualname____doc__	__slots__r   r   r   r   r   r   r   r   r#   intr%   r&   r   r   r   r   r	      s    r	   N)
collections.abcr   r   r   typingr   r   r   r   r	   r   r   r   r   <module>   s
   