o
    i                     @  s   d dl mZ d dlZd dlmZ d dlmZmZ d dlm	Z	 d dl
mZ d dlmZ ee d dlmZ W d   n1 s@w   Y  erMd d	lmZ ddd
dddZdS )    )annotationsN)Path)IOTYPE_CHECKING)normalize_filepath)wrap_df)parse_columns_arg)PyDataFrame)	DataFrame)columnsn_rowssourcestr | Path | IO[bytes] | bytesr   list[int] | list[str] | Noner   
int | Nonereturnr
   c                C  s:   t | ttfrt| } t|\}}t| |||}t|S )a  
    Read into a DataFrame from Apache Avro format.

    Parameters
    ----------
    source
        Path to a file or a file-like object (by "file-like object" we refer to objects
        that have a `read()` method, such as a file handler like the builtin `open`
        function, or a `BytesIO` instance). For file-like objects, the stream position
        may not be updated accordingly after reading.
    columns
        Columns to select. Accepts a list of column indices (starting at zero) or a list
        of column names.
    n_rows
        Stop reading from Apache Avro file after reading `n_rows`.

    Returns
    -------
    DataFrame
    )
isinstancestrr   r   r   r	   	read_avror   )r   r   r   Z
projectionZcolumn_namesZpydf r   E/home/app/Keep/.python/lib/python3.10/site-packages/polars/io/avro.pyr      s
   r   )r   r   r   r   r   r   r   r
   )
__future__r   
contextlibpathlibr   typingr   r   Zpolars._utils.variousr   Zpolars._utils.wrapr   Zpolars.io._utilsr   suppressImportErrorZpolars._plrr	   Zpolarsr
   r   r   r   r   r   <module>   s    