o
    i                     @  sX   d dl mZ d dlmZ d dlmZ d dlmZ er"d dl	m
Z
mZ eddddZdS )    )annotations)TYPE_CHECKINGN)DEFAULT_QUERY_OPT_FLAGS)	LazyFrameQueryOptFlags)optimizationslfr   allow_local_scansboolr   r   returnbytesc                C  s$   |  }| j|j}tj||dS )a  
    Prepare the given LazyFrame for execution on Polars Cloud.

    Parameters
    ----------
    lf
        The LazyFrame to prepare.
    allow_local_scans
        Whether or not to allow local scans in the plan.
    optimizations
        Optimizations to enable or disable in the query optimizer.

    Raises
    ------
    InvalidOperationError
        If the given LazyFrame is not eligible to be run on Polars Cloud.
        The following conditions will disqualify a LazyFrame from being eligible:

        - Contains a user-defined function
        - Scans or sinks to a local filesystem
    ComputeError
        If the given LazyFrame cannot be serialized.
    )r	   )__copy__Z_ldfZwith_optimizationsZ_pyoptflagsplrprepare_cloud_plan)r   r	   r   Zpylf r   J/home/app/Keep/.python/lib/python3.10/site-packages/polars/_utils/cloud.pyr      s   r   )r   r   r	   r
   r   r   r   r   )
__future__r   typingr   Zpolars._plrZ_plrr   Zpolars.lazyframe.opt_flagsr   Zpolarsr   r   r   r   r   r   r   <module>   s    