
    CdE_                    l   d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	m
Z
mZ d dlmZ d dlmZmZmZmZ d dlmZ d dlmZmZmZmZmZ d d	lmZ d d
lmZ d dlm Z m!Z! d dl"m#Z# d dl$m%Z%m&Z&m'Z'm(Z(m)Z) ddgZ* ej+        ded                   Z,d Z-d Z.d Z/d Z0dddZed$d            Z1d Z2d Z3d Z4 G d dee%          Z5d%dZ6 G d d e5          Z7 G d! d"e5          Z8ej9        ej:        ej;        ej<        ej=        ej>        ej?        ej@        ejA        ejB        ejC        ejD        ejE        ejF        ejG        ejH        ejI        ejJ        ejK        ejL        ejM        ejN        ejO        fD ]ZPe5Q                    eP           	 e5Q                    ejR                   n# eS$ r Y nw xY wd# ZTdS )&    )annotationsN)Iterator)fieldsis_dataclassreplace)partial)concatcurrymergeunique)config)DaskMethodsMixindont_optimizeis_dask_collectionnamed_schedulersreplace_name_in_key)tokenize)globalmethod)flattenquote)HighLevelGraph)OperatorMethodMixinapplyfuncnameis_namedtuple_instancemethodcallerDelayeddelayedthreadssyncc                B    t          t          |            }|sdg|z  }|S )z,Unzip a list of lists into ``nout`` outputs. )listzip)lsnoutouts      ,lib/python3.11/site-packages/dask/delayed.pyunzipr)   '   s)    
sBx..C dTkJ    c                    t          |           sJ dt          |           z   }|                                 }|                                 \  }}|||f|z   i}t	          j        ||| g          }t          ||          S )N	finalize-dependencies)r   r   __dask_keys____dask_postcompute__r   from_collectionsr   )
collectionnamekeysfinalizeargslayergraphs          r(   r5   r5   /   s    j)))))*---D##%%D4466NHdHd#d*+E+D%zlSSSE4r*   c                    t           t                    r
 j         ffS t                     rt	                     }|j        |ffS t           t
                    rt                      t                     }|t          t          t          fv rmt          d  D             d          \  }}t          |          }t          t          t          |          t                              }|t          ur||f}||fS |t          u r9t          d                                  D                       \  }}t          |f|fS |t"          u r1t           j         j         j        g          \  }}t"          g|R |fS t+                     rt           fdt-                     D                       \  }}|s dfS 	  fdt-                     D             }t/           fi | nG# t0          $ r}t1          d| d	          |d
}~wt2          $ r}t3          d| d          |d
}~ww xY wt4          |dt          |ff|fS t7                     r$t          d  D                       \  }}|g|R |fS  dfS )a  Normalize a python object and merge all sub-graphs.

    - Replace ``Delayed`` with their keys
    - Convert literals to things the schedulers can handle
    - Extract dask graphs from all enclosed values

    Parameters
    ----------
    expr : object
        The object to be normalized. This function knows how to handle
        dask collections, as well as most builtin python types.

    Returns
    -------
    task : normalized task to be run
    collections : a tuple of collections

    Examples
    --------
    >>> import dask
    >>> a = delayed(1, 'a')
    >>> b = delayed(2, 'b')
    >>> task, collections = unpack_collections([a, b, 3])
    >>> task
    ['a', 'b', 3]
    >>> collections
    (Delayed('a'), Delayed('b'))

    >>> task, collections = unpack_collections({a: 1, b: 2})
    >>> task
    (<class 'dict'>, [['a', 1], ['b', 2]])
    >>> collections
    (Delayed('a'), Delayed('b'))
    c              3  4   K   | ]}t          |          V  d S N)unpack_collections.0es     r(   	<genexpr>z%unpack_collections.<locals>.<genexpr>j   s+      "G"GQ#5a#8#8"G"G"G"G"G"Gr*      keyc                    g | ]	\  }}||g
S r"   r"   r>   kvs      r(   
<listcomp>z&unpack_collections.<locals>.<listcomp>s   s     /P/P/P41aA/P/P/Pr*   c                r    g | ]3}t          |j                  |j        t          |j                  g4S r"   hasattrr3   getattrr>   fexprs     r(   rH   z&unpack_collections.<locals>.<listcomp>|   N       4((qv../  r*   r"   c                p    i | ]2}t          |j                  |j        t          |j                  3S r"   rJ   rM   s     r(   
<dictcomp>z&unpack_collections.<locals>.<dictcomp>   sK       4((af--  r*   zFailed to unpack z> instance. Note that using a custom __init__ is not supported.NzF instance. Note that using fields with `init=False` are not supported.c                    g | ]}|S r"   r"   r>   rG   s     r(   rH   z&unpack_collections.<locals>.<listcomp>   s    /@/@/@a/@/@/@r*   )
isinstancer   _keyr   r5   r   tupletyper#   setr)   r   r	   iddictr<   itemsslicestartstopstepr   r   r   	TypeError
ValueErrorr   r   )rO   	finalizedtypr6   collections_fieldsr?   s   `      r(   r<   r<   :   s%   F $   "y4'!!$ ,TNN	~	|++$!! T{{
t**C
tUC   !"G"G$"G"G"GKKkDzzF6+#6#6B???@@d??;D[  
d{{./P/P4::<</P/P/PQQkd|[((
e||.
DIty/QRRk~~~{**D ;.     
 
k  	8O	     G
 D$$G$$$$ 	 	 	FC F F F    	 	 	NC N N N  	
 sBt-{::d## )./@/@4/@/@/@AAk|d||[((8Os$   <(G% %
H)/HH)H$$H)c                    t          j        dd           t           t                    r j         j        fS t                     rdt           d          z   }                                 }t           dt                    }                                 \  }}|||f|z   i}|                     |                                 |                     ||fS t           t                    rt                      t!                     }|t          t"          t$          fv rNt'          d  D             d          \  }}t          |          }t)          |          }|t          u r||fn||f|fS |t*          u r9t-          d	                                  D                       \  }}t*          |f|fS t1                     r?t-           fd
t3                     D                       \  }}t4          |dt*          |ff|fS t7                     r$t-          d  D                       \  }}|g|R |fS |t8          u r>t-           j         j         j        g          \  }}t8          ft#          |          z   |fS  i fS )a  Normalize a python object and merge all sub-graphs.

    - Replace ``Delayed`` with their keys
    - Convert literals to things the schedulers can handle
    - Extract dask graphs from all enclosed values

    Parameters
    ----------
    expr : object
        The object to be normalized. This function knows how to handle
        ``Delayed``s, as well as most builtin python types.

    Returns
    -------
    task : normalized task to be run
    dask : a merged dask graph that forms the dag for this task

    Examples
    --------
    >>> import dask
    >>> a = delayed(1, 'a')
    >>> b = delayed(2, 'b')
    >>> task, dask = to_task_dask([a, b, 3])  # doctest: +SKIP
    >>> task  # doctest: +SKIP
    ['a', 'b', 3]
    >>> dict(dask)  # doctest: +SKIP
    {'a': 1, 'b': 2}

    >>> task, dasks = to_task_dask({a: 1, b: 2})  # doctest: +SKIP
    >>> task  # doctest: +SKIP
    (dict, [['a', 1], ['b', 2]])
    >>> dict(dask)  # doctest: +SKIP
    {'a': 1, 'b': 2}
    zYThe dask.delayed.to_dask_dask function has been Deprecated in favor of unpack_collectionsrA   )
stacklevelr,   Tpure__dask_optimize__c              3  4   K   | ]}t          |          V  d S r;   )to_task_daskr=   s     r(   r@   zto_task_dask.<locals>.<genexpr>   s(      ;;\!__;;;;;;r*   c                    g | ]	\  }}||g
S r"   r"   rE   s      r(   rH   z to_task_dask.<locals>.<listcomp>   s     !B!B!BTQ1a&!B!B!Br*   c                r    g | ]3}t          |j                  |j        t          |j                  g4S r"   rJ   rM   s     r(   rH   z to_task_dask.<locals>.<listcomp>   rP   r*   r"   c                    g | ]}|S r"   r"   rT   s     r(   rH   z to_task_dask.<locals>.<listcomp>   s    !2!2!2!!2!2!2r*   ) warningswarnrU   r   rC   daskr   r   r/   rL   r   r0   update__dask_graph__r   r#   rX   rW   rY   r)   r   r[   rm   r\   r   r   r   r   r]   r^   r_   r`   )	rO   r3   r4   optr5   r6   dskrd   daskss	   `        r(   rm   rm      s   F M	4    $   #x""$ Xd6666!!##d/??2244$h%,-

33t**,,d33444Sy$!! Dzz
t**C
tUC   ;;d;;;Q??eDzzEll!Tkkc{{dS/AA
d{{ !B!BTZZ\\!B!B!BCC	cd|S  D 	3      
 
	c sBt-s22d## ! !2!2T!2!2!233	c|d||S  
e|| $*di!CDD	cx%++%s**8Or*   ri   c                    | t          j        dd          } | rt          |i |S t          t	          j                              S )ar  Mapping function from task -> consistent name.

    Parameters
    ----------
    args : object
        Python objects that summarize the task.
    pure : boolean, optional
        If True, a consistent hash function is tried on the input. If this
        fails, then a unique identifier is used. If False (default), then a
        unique identifier is always used.
    Ndelayed_pureF)r   get	_tokenizestruuiduuid4)rj   r6   kwargss      r(   r   r      sI     |z.%00 !$)&)))4:<<   r*   Tc                |   t          | t                    r| S t          |           s|rt          |           \  }}nt	          |           }t                      }|.t          |          t          u r|dk    st          d|z            || u r[|sF	 | j	        }n$# t          $ r t          |           j	        }Y nw xY wt          | ||          }| d| }t          | |||          S |s(t          |           j	         dt          ||           }||i}	t          j        ||	|          }
t          ||
|          S )aH  Wraps a function or object to produce a ``Delayed``.

    ``Delayed`` objects act as proxies for the object they wrap, but all
    operations on them are done lazily by building up a dask graph internally.

    Parameters
    ----------
    obj : object
        The function or object to wrap
    name : string or hashable, optional
        The key to use in the underlying graph for the wrapped object. Defaults
        to hashing content. Note that this only affects the name of the object
        wrapped by this call to delayed, and *not* the output of delayed
        function calls - for that use ``dask_key_name=`` as described below.

        .. note::

           Because this ``name`` is used as the key in task graphs, you should
           ensure that it uniquely identifies ``obj``. If you'd like to provide
           a descriptive name that is still unique, combine the descriptive name
           with :func:`dask.base.tokenize` of the ``array_like``. See
           :ref:`graphs` for more.

    pure : bool, optional
        Indicates whether calling the resulting ``Delayed`` object is a pure
        operation. If True, arguments to the call are hashed to produce
        deterministic keys. If not provided, the default is to check the global
        ``delayed_pure`` setting, and fallback to ``False`` if unset.
    nout : int, optional
        The number of outputs returned from calling the resulting ``Delayed``
        object. If provided, the ``Delayed`` output of the call can be iterated
        into ``nout`` objects, allowing for unpacking of results. By default
        iteration over ``Delayed`` objects will error. Note, that ``nout=1``
        expects ``obj`` to return a tuple of length 1, and consequently for
        ``nout=0``, ``obj`` should return an empty tuple.
    traverse : bool, optional
        By default dask traverses builtin python collections looking for dask
        objects passed to ``delayed``. For large collections this can be
        expensive. If ``obj`` doesn't contain any dask objects, set
        ``traverse=False`` to avoid doing this traversal.

    Examples
    --------
    Apply to functions to delay execution:

    >>> from dask import delayed
    >>> def inc(x):
    ...     return x + 1

    >>> inc(10)
    11

    >>> x = delayed(inc, pure=True)(10)
    >>> type(x) == Delayed
    True
    >>> x.compute()
    11

    Can be used as a decorator:

    >>> @delayed(pure=True)
    ... def add(a, b):
    ...     return a + b
    >>> add(1, 2).compute()
    3

    ``delayed`` also accepts an optional keyword ``pure``. If False, then
    subsequent calls will always produce a different ``Delayed``. This is
    useful for non-pure functions (such as ``time`` or ``random``).

    >>> from random import random
    >>> out1 = delayed(random, pure=False)()
    >>> out2 = delayed(random, pure=False)()
    >>> out1.key == out2.key
    False

    If you know a function is pure (output only depends on the input, with no
    global state), then you can set ``pure=True``. This will attempt to apply a
    consistent name to the output, but will fallback on the same behavior of
    ``pure=False`` if this fails.

    >>> @delayed(pure=True)
    ... def add(a, b):
    ...     return a + b
    >>> out1 = add(1, 2)
    >>> out2 = add(1, 2)
    >>> out1.key == out2.key
    True

    Instead of setting ``pure`` as a property of the callable, you can also set
    it contextually using the ``delayed_pure`` setting. Note that this
    influences the *call* and not the *creation* of the callable:

    >>> @delayed
    ... def mul(a, b):
    ...     return a * b
    >>> import dask
    >>> with dask.config.set(delayed_pure=True):
    ...     print(mul(1, 2).key == mul(1, 2).key)
    True
    >>> with dask.config.set(delayed_pure=False):
    ...     print(mul(1, 2).key == mul(1, 2).key)
    False

    The key name of the result of calling a delayed object is determined by
    hashing the arguments by default. To explicitly set the name, you can use
    the ``dask_key_name`` keyword when calling the function:

    >>> add(1, 2)   # doctest: +SKIP
    Delayed('add-3dce7c56edd1ac2614add714086e950f')
    >>> add(1, 2, dask_key_name='three')
    Delayed('three')

    Note that objects with the same key name are assumed to have the same
    result. If you set the names explicitly you should make sure your key names
    are different for different results.

    >>> add(1, 2, dask_key_name='three')
    Delayed('three')
    >>> add(2, 1, dask_key_name='three')
    Delayed('three')
    >>> add(2, 2, dask_key_name='four')
    Delayed('four')

    ``delayed`` can also be applied to objects to make operations on them lazy:

    >>> a = delayed([1, 2, 3])
    >>> isinstance(a, Delayed)
    True
    >>> a.compute()
    [1, 2, 3]

    The key name of a delayed object is hashed by default if ``pure=True`` or
    is generated randomly if ``pure=False`` (default).  To explicitly set the
    name, you can use the ``name`` keyword. To ensure that the key is unique
    you should include the tokenized value as well, or otherwise ensure that
    it's unique:

    >>> from dask.base import tokenize
    >>> data = [1, 2, 3]
    >>> a = delayed(data, name='mylist-' + tokenize(data))
    >>> a  # doctest: +SKIP
    Delayed('mylist-55af65871cb378a4fa6de1660c3e8fb7')

    Delayed results act as a proxy to the underlying object. Many operators
    are supported:

    >>> (a + [1, 2]).compute()
    [1, 2, 3, 1, 2]
    >>> a[1].compute()
    2

    Method and attribute access also works:

    >>> a.count(2).compute()
    1

    Note that if a method doesn't exist, no error will be thrown until runtime:

    >>> res = a.not_a_real_method() # doctest: +SKIP
    >>> res.compute()  # doctest: +SKIP
    AttributeError("'list' object has no attribute 'not_a_real_method'")

    "Magic" methods (e.g. operators and attribute access) are assumed to be
    pure, meaning that subsequent calls must return the same results. This
    behavior is not overrideable through the ``delayed`` call, but can be
    modified using other ways as described below.

    To invoke an impure attribute or operator, you'd need to use it in a
    delayed function with ``pure=False``:

    >>> class Incrementer:
    ...     def __init__(self):
    ...         self._n = 0
    ...     @property
    ...     def n(self):
    ...         self._n += 1
    ...         return self._n
    ...
    >>> x = delayed(Incrementer())
    >>> x.n.key == x.n.key
    True
    >>> get_n = delayed(lambda x: x.n, pure=False)
    >>> get_n(x).key == get_n(x).key
    False

    In contrast, methods are assumed to be impure by default, meaning that
    subsequent calls may return different results. To assume purity, set
    ``pure=True``. This allows sharing of any intermediate values.

    >>> a.count(2, pure=True).key == a.count(2, pure=True).key
    True

    As with function calls, method calls also respect the global
    ``delayed_pure`` setting and support the ``dask_key_name`` keyword:

    >>> a.count(2, dask_key_name="count_2")
    Delayed('count_2')
    >>> import dask
    >>> with dask.config.set(delayed_pure=True):
    ...     print(a.count(2).key == a.count(2).key)
    True
    Nr   z3nout must be None or a non-negative integer, got %sri   -rj   r&   r-   )rU   r   r   r<   r   rY   rX   intrb   __name__AttributeErrorr   DelayedLeafr   r1   )objr3   rj   r&   traversetaskre   prefixtokenr7   r8   s              r(   r   r     s{   Z #w 
# ( .s33kkSzzeeLT$ZZ3..4199NQUUVVVs{{ 	',! , , ,c+,S$T222E&&u&&D34d;;;; 	G3ii(FF8Dt+D+D+DFFDt/e+VVVtUD)))s   B B98B9c                     | ||          S r;   r"   )methodselfothers      r(   _swapr     s    6%r*   c                ,    t          t          |           S )z@Wrapper to create 'right' version of operator given left version)r   r   )r   s    r(   rightr     s    5&!!!r*   c                   t          |t          t          f          s|g}t          | t                    s$t          j        t          |           | d          } |                     t          t          |                              } | S Nr"   r-   )rU   r#   rY   r   r1   rZ   cullr   )rw   r4   r   s      r(   optimizer     ss    dT3K(( vc>** M-bggsLLL
((3wt}}%%
&
&CJr*   c                     e Zd ZdZdZddZed             Zed             Zd Z	d Z
d	 Zd
 Z ee          Z eed          Zd Zd ZdddZd Zd Zd Zd Zd Zd Zd Zd ZddddZd ZeZ d Z!e"d d            Z#e#Z$dS )!r   zpRepresents a value to be computed by dask.

    Equivalent to the output from a single key in a dask graph.
    )rV   _dask_length_layerNc                    || _         || _        || _        |p|| _        t	          |t
                    r:| j        |j        vr.t          d| j         dt          |j                             d S d S )NzLayer z% not in the HighLevelGraph's layers: )	rV   r   r   r   rU   r   layersrb   r#   )r   rC   rw   lengthr7   s        r(   __init__zDelayed.__init__  s    	
 lsc>** 	t{#*/L/L]]]4PSPZK[K[]]  	 	/L/Lr*   c                    | j         S r;   )rV   r   s    r(   rC   zDelayed.key  s
    yr*   c                    | j         S r;   )r   r   s    r(   rs   zDelayed.dask   s
    zr*   c                    | j         S r;   )rs   r   s    r(   ru   zDelayed.__dask_graph__$  s
    yr*   c                    | j         gS r;   rB   r   s    r(   r/   zDelayed.__dask_keys__'  s    zr*   c                    | j         fS r;   )r   r   s    r(   __dask_layers__zDelayed.__dask_layers__*  s    ~r*   c                    | j         S r;   rB   r   s    r(   __dask_tokenize__zDelayed.__dask_tokenize__-  s	    xr*   delayed_optimizerB   c                    t           dfS Nr"   )
single_keyr   s    r(   r0   zDelayed.__dask_postcompute__3  s    2~r*   c                    | j         dfS r   )_rebuildr   s    r(   __dask_postpersist__zDelayed.__dask_postpersist__6  s    }b  r*   )renamec                  |rt          | j        |          n| j        }t          |t                    r:t	          |j                  dk    r"t          t          |j                            }nd }t          ||| j	        |          S )N   )r7   )
r   rC   rU   r   lenr   nextiterr   r   )r   rw   r   rC   r7   s        r(   r   zDelayed._rebuild9  s}    7=K!$(F33348c>** 	s3:!/C/C
 cj))**EEEsCU;;;;r*   c                2    dt          | j                   dS )NzDelayed())reprrC   r   s    r(   __repr__zDelayed.__repr__E  s    +$tx..++++r*   c                *    t          | j                  S r;   )hashrC   r   s    r(   __hash__zDelayed.__hash__H  s    DH~~r*   c                :    t          t          |                     S r;   )dirrX   r   s    r(   __dir__zDelayed.__dir__K  s    4::r*   c                    |                     d          rt          d| d          |dk    rt          j        d           t	          | |          S )N_z
Attribute z
 not found	visualisezOdask.delayed objects have no `visualise` method. Perhaps you meant `visualize`?)
startswithr   rq   rr   DelayedAttr)r   attrs     r(   __getattr__zDelayed.__getattr__N  si    ??3 	@ !>d!>!>!>???; M1  
 4&&&r*   c                z    	 t                               | ||           d S # t          $ r t          d          w xY wNzDelayed objects are immutable)object__setattr__r   ra   )r   r   vals      r(   r   zDelayed.__setattr__\  sQ    	=tT3///// 	= 	= 	= ;<<<	=s     :c                     t          d          r   ra   )r   indexr   s      r(   __setitem__zDelayed.__setitem__g  s    7888r*   c              #  x   K   | j         t          d          t          | j                   D ]}| |         V  d S )Nz6Delayed objects of unspecified length are not iterable)r   ra   range)r   is     r(   __iter__zDelayed.__iter__j  sO      <TUUUt|$$ 	 	Aq'MMMM	 	r*   c                <    | j         t          d          | j         S )Nz3Delayed objects of unspecified length have no len())r   ra   r   s    r(   __len__zDelayed.__len__p  s!    <QRRR|r*   )rj   dask_key_namec               j    t          t          |          }| || |||          S  || ||          S )Nri   )r   )r   r   )r   rj   r   r6   r   funcs         r(   __call__zDelayed.__call__u  sG    u4((($4dF-HHHHtD$'''r*   c                     t          d          )Nz)Truth of Delayed objects is not supportedr   r   s    r(   __bool__zDelayed.__bool__{  s    CDDDr*   c                4    || S t          j        | |          S r;   )types
MethodType)r   instanceclss      r(   __get__zDelayed.__get__  s     Kh///r*   Fc                R    t          |rt          |          n|d          fdS )NTri   c                      | i |S r;   r"   )r6   r   r   s     r(   <lambda>z.Delayed._get_binary_operator.<locals>.<lambda>  s    vvt'>v'>'> r*   )r   r   )r   opinvr   s      @r(   _get_binary_operatorzDelayed._get_binary_operator  s3    c1rr===>>>>>r*   NN)F)%r   
__module____qualname____doc__	__slots__r   propertyrC   rs   ru   r/   r   r   staticmethodDEFAULT_GET__dask_scheduler__r   r   rk   r0   r   r   r   r   r   r   r   r   r   r   r   r   __nonzero__r   classmethodr   _get_unary_operatorr"   r*   r(   r   r     s        
 7I
 
 
 
   X   X         &k22$X3EFFF  ! ! ! '+ 
< 
< 
< 
< 
<, , ,    ' ' '	= 	= 	=9 9 9    
 $(t ( ( ( ( (E E E K0 0 0
 ? ? ? [? /r*   c                @   |                     dd           }|                     d|          }|4d                    t          |           t          |g|R d|i|          }n|}t	          t          t          |          d          \  }}	t          t          |	                    }	|r@t          |          \  }
}|		                    |           t          | t          |          |
f}n| f|z   }t          j        |||i|	          }||nd }t          |||          S )Nr   rj   z{}-{}rA   r-   )r   )popformatr   r   r)   mapr<   r#   r	   extendr   r   r1   r   )r   
func_tokenr6   r   rj   r&   r   r3   args2re   dask_kwargscollections2r   r8   s                 r(   call_functionr     s=   JJ55M::fd##D~~TNNZ<$<<<T<V<<
 

 s#5t<<a@@E;vk**++K $6v$>$>!\<(((tT%[[+6w+tTl  E #44D4t,,,,r*   c                  l     e Zd ZdZd fd	Zed             Zd Zed             Z ed             Z xZ	S )	r   )_obj_pure_noutNc                v    t                                          |d            || _        || _        || _        d S r;   )superr   r   r   r  )r   r   rC   rj   r&   	__class__s        r(   r   zDelayedLeaf.__init__  s6    d###	



r*   c                R    t          j        | j        | j        | j        id          S r   )r   r1   rV   r   r   s    r(   rs   zDelayedLeaf.dask  s.    .I	49-B
 
 
 	
r*   c                T    t          | j        | j        ||| j        | j                  S )Nr   )r   r   rV   r   r  r   r6   r   s      r(   r   zDelayedLeaf.__call__  s.    Ity$TZdj
 
 
 	
r*   c                    | j         j        S r;   )r   r   r   s    r(   r   zDelayedLeaf.__name__  s    y!!r*   c                    | j         j        S r;   )r   r   r   s    r(   r   zDelayedLeaf.__doc__  s    y  r*   r   )
r   r   r   r   r   r   rs   r   r   __classcell__r  s   @r(   r   r     s        *I      
 
 X


 
 

 " " X" ! ! X! ! ! ! !r*   r   c                  H     e Zd ZdZ fdZ fdZed             Zd Z xZ	S )r   )r   _attrc                    dt          ||d          z  }t                                          |d            || _        || _        d S )Nz
getattr-%sTri   )r   r  r   r   r  )r   r   r   rC   r  s       r(   r   zDelayedAttr.__init__  sH    Xc4d;;;;d###	


r*   c                    |dk    r| j         dk    rt          d          t                                          |          S )NdtypezAttribute dtype not found)r  r   r  r   )r   r   r  s     r(   r   zDelayedAttr.__getattr__  sA     7??tzW44 !<===ww""4(((r*   c                    | j         t          | j        j         | j        fi}t	          j        | j         || j        g          S )Nr-   )rV   rL   r   r  r   r1   )r   r7   s     r(   rs   zDelayedAttr.dask  sB    WdindjAB.IuDI;
 
 
 	
r*   c                f    t          t          | j                  | j        | j        f|z   |          S r;   )r   r   r  r   r  s      r(   r   zDelayedAttr.__call__  s2    $$dj49,2Ev
 
 	
r*   )
r   r   r   r   r   r   r   rs   r   r
  r  s   @r(   r   r     s        !I    ) ) ) ) ) 
 
 X

 
 
 
 
 
 
r*   r   c                    | d         S )z6Pick out the only element of this list, a list of keysr   r"   )seqs    r(   r   r   	  s    q6Mr*   )NNNTr   )U
__future__r   operatorr   r~   rq   collections.abcr   dataclassesr   r   r   	functoolsr   tlzr	   r
   r   r   rs   r   	dask.baser   r   r   r   r   r   r|   dask.contextr   	dask.corer   r   dask.highlevelgraphr   
dask.utilsr   r   r   r   r   __all__r{   r   r)   r5   r<   rm   r   r   r   r   r   r   r   r   absnegposinvertaddsubmulfloordivtruedivmodpowand_or_xorlshiftrshifteqgegtneleltgetitemr   _bind_operatormatmulr   r   r"   r*   r(   <module>r:     s   " " " " " "     $ $ $ $ $ $ 5 5 5 5 5 5 5 5 5 5       , , , , , , , , , , , ,                    , + + + + + % % % % % % $ $ $ $ $ $ $ $ . . . . . .              i
  #"9.>v.FGG       a a aHW W Wt  ! ! ! ! !* e* e* e* e*P  " " "
  B/ B/ B/ B/ B/ 3 B/ B/ B/J- - - -:! ! ! ! !' ! ! !:
 
 
 
 
' 
 
 
B LLLOLLLLLMLLOOKKKKKK/  B2 2	8?++++ 	 	 	D	    s   F& &F.-F.