
    bi                    <    d dl mZ d dlmZ d dlmZ d dlmZ ddZy)    )annotations)	FrameBase)
_df_to_bag)tokenizec           	        ddl m} | j                         } t        | t              st        d      dt        | j                  ||      z   }|dk(  r| j                  }| j                  }nUt        | j                               D ci c]  \  }}||ft        |||f }}}|j                  | j                                 |||| j                        S c c}}w )a1  Create Dask Bag from a Dask DataFrame

    Parameters
    ----------
    index : bool, optional
        If True, the elements are tuples of ``(index, value)``, otherwise
        they're just the ``value``.  Default is False.
    format : {"tuple", "dict", "frame"}, optional
        Whether to return a bag of tuples, dictionaries, or
        dataframe-like objects. Default is "tuple". If "frame",
        the original partitions of ``df`` will not be transformed
        in any way.


    Examples
    --------
    >>> bag = df.to_bag()  # doctest: +SKIP
    r   )Bagz%df must be either DataFrame or Serieszto_bag-frame)dask.bag.corer   optimize
isinstancer   	TypeErrorr   _namedask	enumerate__dask_keys__r   update__dask_graph__npartitions)dfindexformatr   namedskiblocks           Z/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/dask/dataframe/dask_expr/io/bag.pyto_bagr      s    & "	Bb)$?@@x%88Dggxx ((8(8(:;
E 1I
E5&99
 
 	

2$$&'sD"..))
s   CN)Ftuple)	
__future__r   dask.dataframe.dask_exprr   dask.dataframe.io.ior   dask.tokenizer   r        r   <module>r%      s    " . + "#*r$   