o
    b²“i  ã                   @   s8   d dl Z d dlmZ d dlmZmZ G dd„ deƒZdS )é    N)ÚMapping)ÚAnyÚDictc                   @   sR   e Zd ZdZdefdd„Zejdee	ef fdd„ƒZ
dd	„ Zd
d„ Zdd„ ZdS )ÚTableRowaæ  
    A dict-like row of a tabular ``Dataset``.

    This implements the dictionary mapping interface, but provides more
    efficient access with less data copying than converting Arrow Tables
    or Pandas DataFrames into per-row dicts. This class must be subclassed,
    with subclasses implementing ``__getitem__``, ``__iter__``, and ``__len__``.

    Concrete subclasses include ``ray.data._internal.arrow_block.ArrowRow`` and
    ``ray.data._internal.pandas_block.PandasRow``.
    Úrowc                 C   s
   || _ dS )z‡
        Construct a ``TableRow`` (internal API).

        Args:
            row: The tabular row that backs this row mapping.
        N)Ú_row)Úselfr   © r	   úJ/home/ubuntu/.local/lib/python3.10/site-packages/ray/data/_internal/row.pyÚ__init__   s   
zTableRow.__init__Úreturnc                 C   s   dS )zYConvert to a normal Python dict.

        This can create a new copy of the row.
        Nr	   ©r   r	   r	   r
   Ú	as_pydict   s   zTableRow.as_pydictc                 C   s   t |  ¡ ƒS ©N)Ústrr   r   r	   r	   r
   Ú__str__$   s   zTableRow.__str__c                 C   s   t | ƒS r   )r   r   r	   r	   r
   Ú__repr__'   s   zTableRow.__repr__c                 C   s"   ddl m} |ddƒ}|| ||ƒS )Nr   )Ú_dict_pprinter_factoryÚ{Ú})ÚIPython.lib.prettyr   )r   ÚpÚcycler   Úpprinterr	   r	   r
   Ú_repr_pretty_*   s   
zTableRow._repr_pretty_N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚabcÚabstractmethodr   r   r   r   r   r   r	   r	   r	   r
   r      s    	r   )r   Úcollections.abcr   Útypingr   r   r   r	   r	   r	   r
   Ú<module>   s    