
    d|                         d 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 ddlmZmZmZmZmZmZmZ d	Z G d
 dej        e          ZdS )z"Here is defined the VLArray class.    N   )hdf5extension)
ObjectAtomVLStringAtomVLUnicodeAtominternal_to_flavor)Leafcalc_chunksize)convert_to_np_atomconvert_to_np_atom2idx2longcorrect_byteorderSizeTypeis_idxlazyattrz1.4c                        e Zd ZdZdZed             Zed             Zed             Z	ed             Z
	 	 	 	 d fd
	Z fdZd Zd Zd Zd Zd Zd ZddZd Zd Zd Zd Zd Zd Zd dZd Zd Zd Z xZS )!VLArraya  This class represents variable length (ragged) arrays in an HDF5 file.

    Instances of this class represent array objects in the object tree
    with the property that their rows can have a *variable* number of
    homogeneous elements, called *atoms*. Like Table datasets (see
    :ref:`TableClassDescr`), variable length arrays can have only one
    dimension, and the elements (atoms) of their rows can be fully
    multidimensional.

    When reading a range of rows from a VLArray, you will *always* get
    a Python list of objects of the current flavor (each of them for a
    row), which may have different lengths.

    This class provides methods to write or read data to or from
    variable length array objects in the file. Note that it also
    inherits all the public attributes and methods that Leaf (see
    :ref:`LeafClassDescr`) already provides.

    .. note::

          VLArray objects also support compression although compression
          is only performed on the data structures used internally by
          the HDF5 to take references of the location of the variable
          length data. Data itself (the raw data) are not compressed
          or filtered.

          Please refer to the `VLTypes Technical Note
          <https://support.hdfgroup.org/HDF5/doc/TechNotes/VLTypes.html>`_
          for more details on the topic.

    Parameters
    ----------
    parentnode
        The parent :class:`Group` object.
    name : str
        The name of this node in its parent group.
    atom
        An `Atom` instance representing the *type* and *shape* of the atomic
        objects to be saved.
    title
        A description for this node (it sets the ``TITLE`` HDF5 attribute on
        disk).
    filters
        An instance of the `Filters` class that provides information about the
        desired I/O filters to be applied during the life of this object.
    expectedrows
        A user estimate about the number of row elements that will
        be added to the growable dimension in the `VLArray` node.
        If not provided, the default value is ``EXPECTED_ROWS_VLARRAY``
        (see ``tables/parameters.py``).  If you plan to create either
        a much smaller or a much bigger `VLArray` try providing a guess;
        this will optimize the HDF5 B-Tree creation and management
        process time and the amount of memory used.

        .. versionadded:: 3.0

    chunkshape
        The shape of the data chunk to be read or written in a single HDF5 I/O
        operation.  Filters are applied to those chunks of data.  The
        dimensionality of `chunkshape` must be 1.  If ``None``, a sensible
        value is calculated (which is recommended).
    byteorder
        The byteorder of the data *on disk*, specified as 'little' or 'big'.
        If this is not specified, the byteorder is that of the platform.

    track_times
        Whether time data associated with the leaf are recorded (object
        access time, raw data modification time, metadata change time, object
        birth time); default True.  Semantics of these times depend on their
        implementation in the HDF5 library: refer to documentation of the
        H5O_info_t data structure.  As of HDF5 1.8.15, only ctime (metadata
        change time) is implemented.

        .. versionadded:: 3.4.3


    .. versionchanged:: 3.0
       *parentNode* renamed into *parentnode*.

    .. versionchanged:: 3.0
       The *expectedsizeinMB* parameter has been replaced by *expectedrows*.

    Examples
    --------
    See below a small example of the use of the VLArray class.  The code is
    available in :file:`examples/vlarray1.py`::

        import numpy as np
        import tables as tb

        # Create a VLArray:
        fileh = tb.open_file('vlarray1.h5', mode='w')
        vlarray = fileh.create_vlarray(
            fileh.root,
            'vlarray1',
            tb.Int32Atom(shape=()),
            "ragged array of ints",
            filters=tb.Filters(1))

        # Append some (variable length) rows:
        vlarray.append(np.array([5, 6]))
        vlarray.append(np.array([5, 6, 7]))
        vlarray.append([5, 6, 9, 8])

        # Now, read it through an iterator:
        print('-->', vlarray.title)
        for x in vlarray:
            print('%s[%d]--> %s' % (vlarray.name, vlarray.nrow, x))

        # Now, do the same with native Python strings.
        vlarray2 = fileh.create_vlarray(
            fileh.root,
            'vlarray2',
            tb.StringAtom(itemsize=2),
            "ragged array of strings",
            filters=tb.Filters(1))
        vlarray2.flavor = 'python'

        # Append some (variable length) rows:
        print('-->', vlarray2.title)
        vlarray2.append(['5', '66'])
        vlarray2.append(['5', '6', '77'])
        vlarray2.append(['5', '6', '9', '88'])

        # Now, read it through an iterator:
        for x in vlarray2:
            print('%s[%d]--> %s' % (vlarray2.name, vlarray2.nrow, x))

        # Close the file.
        fileh.close()

    The output for the previous script is something like::

        --> ragged array of ints
        vlarray1[0]--> [5 6]
        vlarray1[1]--> [5 6 7]
        vlarray1[2]--> [5 6 9 8]
        --> ragged array of strings
        vlarray2[0]--> ['5', '66']
        vlarray2[1]--> ['5', '6', '77']
        vlarray2[2]--> ['5', '6', '9', '88']


    .. rubric:: VLArray attributes

    The instance variables below are provided in addition to those in
    Leaf (see :ref:`LeafClassDescr`).

    .. attribute:: atom

        An Atom (see :ref:`AtomClassDescr`)
        instance representing the *type* and
        *shape* of the atomic objects to be
        saved. You may use a *pseudo-atom* for
        storing a serialized object or variable length string per row.

    .. attribute:: flavor

        The type of data object read from this leaf.

        Please note that when reading several rows of VLArray data,
        the flavor only applies to the *components* of the returned
        Python list, not to the list itself.

    .. attribute:: nrow

        On iterators, this is the index of the current row.

    .. attribute:: nrows

        The current number of rows in the array.

    .. attribute:: extdim

       The index of the enlargeable dimension (always 0 for vlarrays).

    VLARRAYc                     | j         j        S )z9The NumPy ``dtype`` that most closely matches this array.)atomdtypeselfs    .lib/python3.11/site-packages/tables/vlarray.pyr   zVLArray.dtype   s     y    c                     | j         fS )zThe shape of the stored array.)nrowsr   s    r   shapezVLArray.shape   s     
}r   c                      t          d          )z
        The HDF5 library does not include a function to determine size_on_disk
        for variable-length arrays.  Accessing this attribute will raise a
        NotImplementedError.
        z)size_on_disk not implemented for VLArrays)NotImplementedErrorr   s    r   size_on_diskzVLArray.size_on_disk   s     ""MNNNr   c                 *    |                                  S )aq  
        The size of this array's data in bytes when it is fully loaded
        into memory.

        .. note::

            When data is stored in a VLArray using the ObjectAtom type,
            it is first serialized using pickle, and then converted to
            a NumPy array suitable for storage in an HDF5 file.
            This attribute will return the size of that NumPy
            representation.  If you wish to know the size of the Python
            objects after they are loaded from disk, you can use this
            `ActiveState recipe
            <http://code.activestate.com/recipes/577504/>`_.
        )_get_memory_sizer   s    r   size_in_memoryzVLArray.size_in_memory   s    " $$&&&r   N Tc           	         d | _         	 |d ux| _        }	 || _        	 || _        	 ||j        j        d         }|| _        	 d | _        	 d | _        	 d | _	        	 d | _
        	 d | _        	 d | _        	 d | _        	 d | _        	 d| _        	 d | _        	 || _        	 d | _        	 d | _        	 d| _        	 |r|t+          |t,          t.          j        f          r|f}	 t3          |          }n-# t4          $ r  t5          dt7          |          z            w xY wt9          |          dk    rt;          d|          t3          d |D                       | _        t=                                          ||||||	|
           d S )NEXPECTED_ROWS_VLARRAYFr   zI`chunkshape` parameter must be an integer or sequence and you passed a %sr   z&`chunkshape` rank (length) must be 1: c              3   4   K   | ]}t          |          V  d S )N)r   ).0ss     r   	<genexpr>z#VLArray.__init__.<locals>.<genexpr>L  s(      &G&Gqx{{&G&G&G&G&G&Gr   ) 
_v_version_v_new_v_new_title_v_new_filters_v_fileparams_v_expectedrows_v_chunkshape_start_stop_step
_nrowsread_startb_stopb_row_initlistarrr   nrowr   extdim
isinstanceintnpintegertuple	TypeErrortypelen
ValueErrorsuper__init__)r   
parentnodenamer   titlefiltersexpectedrows
chunkshape	byteorder_logtrack_timesnew	__class__s               r   rJ   zVLArray.__init__   s   
 / ,,c?!&%3%-45LML+	 "D 5
5
2G./	2
M* 		 	A
6M  	H:)*sBJ&788 +(]
>":..

 > > >*,0,<,<=> > >> :!## j$.J"1 2 2 2!&&G&GJ&G&G&G!G!GDT3"D+	7 	7 	7 	7 	7s   C+ +*Dc                 V    t                                                       d| _        d S )Nd   )rI   _g_post_init_hook
nrowsinbuf)r   rU   s    r   rX   zVLArray._g_post_init_hookQ  s$    !!###r   c                 x    | j         }||z  dz  }t          |          }||z  }|dk    rd}t          |          fS )z&Calculate the size for the HDF5 chunk.i   r   r   )	_basesizer   r   )r   rO   elemsizeexpected_mb	chunksizerP   s         r   _calc_chunkshapezVLArray._calc_chunkshapeV  sT     > #X-	9";//	 (*
??J$$&&r   c                    | j         }t          | _        t          j        t          j        |j                  dk              }|dk    rt          d          t          |d          s4|j	        j
        | _        |j	        j        | _        |j	        j        | _        n$|j
        | _        |j        | _        |j        | _        |j        | _        |j        | _        | j        |                     | j                  | _        t-          d          | _        | j        $t3          |j        t4          j                  | _        |                     | j                  | _        t          |d          s|j        | j        _         | j        S )z.Create a variable length array (ragged array).r   zPWhen creating VLArrays, none of the dimensions of the Atom instance can be zero.size)!r   	obversionr-   rB   sumarrayr   rH   hasattrbaser   _atomicdtypera   _atomicsizeitemsizer[   rF   _atomictype_atomicshaper4   r_   r3   r   r   rQ   r   sys_create_arrayr/   _v_objectidkindattrs
PSEUDOATOM)r   r   zerodimss      r   	_g_createzVLArray._g_creater  sU    y#6"(4:..!344a<< A B B B tV$$ 	+ $	D#y~D!Y/DNN $
D#yD!]DN9 J %!%!6!6t7K!L!LDa[[
 >!.ty#-HHDN  --d.?@@ tV$$ 	.$(IDJ!r   c                    |                                  \  | _        | _        | _        }d| j        v r]| j        j        }|dk    rt                      }n|dk    rt                      }nt|dk    rt                      }n_t          d|z            | j
        j        dd         dk    r5| j        j        }|d	k    rt                      }n|d
k    rt                      }|| _        | j        S )z+Get the metadata info for an array in file.rq   vlstring	vlunicodeobjectz"pseudo-atom name ``%s`` not known.Nr   1VLStringObject)_open_arrayrn   r   r4   rp   rq   r   r   r   rH   r1   format_versionFLAVORr   )r   r   ro   flavor1xs       r   _g_openzVLArray._g_open  s      	?$*d&8$ 4:%%:(Dz!!#~~$$$!!!|| 84?A A A\(!,33z(H:%%#~~X%%!||	r   c           	         t          j        t          j        |j                  dk              }|dk    rdS |j        }| j        j        }t          |j                  }t          |t                    rt          | j        j                  }n| j        j        f}d}||z
  }||k    rd}nU|dk    r!||d         |k    r|d         }|dd         }n.|dk    r|dk    r	|d         }nt          d|d|d|d          |S )	z.Return the number of objects in a NumPy array.r   r   N)r   zThe object 'z&' is composed of elements with shape 'z1', which is not compatible with the atom shape ('z').)	rB   rc   rd   r   r   rG   r@   rD   rH   )	r   nparrrr   r   
atom_shapeshapelenatomshapelendiflennobjectss	            r   _getnobjectszVLArray._getnobjects  s-    6"(5;//1455a<<1Y_
u{##j%(( 	ty//LL)/+JLL(JHHkkeFGGn
:: QxH!""IEE4HMMQxHH*5:UUEEE:::O P P P r   c                 h    | j         j        dk    rt          d| j        z            | j         j        S )a  Get the enumerated type associated with this array.

        If this array is of an enumerated type, the corresponding Enum instance
        (see :ref:`EnumClassDescr`) is returned. If it is not of an enumerated
        type, a TypeError is raised.

        enumz)array ``%s`` is not of an enumerated type)r   ro   rE   _v_pathnamer   r   s    r   get_enumzVLArray.get_enum  s?     9>V##G"./ 0 0 0 y~r   c                    |                                   | j                                         | j        }t	          |d          s|                    |          }|j        }n0	 t          |           n# t          $ r t          d          w xY w|}t          |          dk    r&t          ||          }| 
                    |          }nd}d}|                     ||           | xj        dz  c_        dS )a  Add a sequence of data to the end of the dataset.

        This method appends the objects in the sequence to a *single row* in
        this array. The type and shape of individual objects must be compliant
        with the atoms in the array. In the case of serialized objects and
        variable length strings, the object or string to append is itself the
        sequence.

        ra   zargument is not a sequencer   Nr   )_g_check_openr1   _check_writabler   re   toarrayrf   rG   rE   r   r   _appendr   )r   sequencer   statomr   r   s         r   appendzVLArray.append  s    	$$&&& ytV$$ 	||H--HYFF>H > > > <===>Fx==1 (&99E((//HHHEUH%%%

a



s   #A3 3Bc                     |                      |||          \  | _        | _        | _        |                                  | S )ao  Iterate over the rows of the array.

        This method returns an iterator yielding an object of the current
        flavor for each selected row in the array.

        If a range is not supplied, *all the rows* in the array are iterated
        upon. You can also use the :meth:`VLArray.__iter__` special method for
        that purpose.  If you only want to iterate over a given *range of rows*
        in the array, you may use the start, stop and step parameters.

        Examples
        --------

        ::

            for row in vlarray.iterrows(step=4):
                print('%s[%d]--> %s' % (vlarray.name, vlarray.nrow, row))

        .. versionchanged:: 3.0
           If the *start* parameter is provided and *stop* is None then the
           array is iterated from *start* to the last line.
           In PyTables < 3.0 only one element was returned.

        )_process_ranger5   r6   r7   
_init_loop)r   startstopsteps       r   iterrowszVLArray.iterrows  sB    4 150C0C41 1-dj$*r   c                 p    | j         s.d| _        | j        | _        d| _        |                                  | S )az  Iterate over the rows of the array.

        This is equivalent to calling :meth:`VLArray.iterrows` with default
        arguments, i.e. it iterates over *all the rows* in the array.

        Examples
        --------

        ::

            result = [row for row in vlarray]

        Which is equivalent to::

            result = [row for row in vlarray.iterrows()]

        r   r   )r<   r5   r   r6   r7   r   r   s    r   __iter__zVLArray.__iter__2  s:    & z 	DKDJDJOOr   c                     | j         | _        | j         | _        d| _        d| _        t          | j         | j        z
            | _        dS )z)Initialization for the __iter__ iterator.TN)r5   r8   r9   r;   r<   r   r7   r>   r   s    r   r   zVLArray._init_loopO  s@     +{	
T[4:566			r   c                    | j         | j        k    rd| _        t          | j        dz   | j        k    s| j        dk     rZ| j        | j        | j        z  z   | _        | 	                    | j        | j        | j                  | _
        d| _        | j        | _        | xj        dz  c_        | xj        | j        z  c_        | xj         | j        z  c_         | j
        | j                 S )zGet the next element of the array during an iteration.

        The element is returned as a list of objects of the current
        flavor.

        Fr   r   r   )r8   r6   r<   StopIterationr;   rY   r9   r7   r:   readr=   r>   r   s    r   __next__zVLArray.__next__X  s     ?dj((DJ y1}//49q=="lTZ$/-II#yyt{DJOO	#{IINIIII#IIOOtz)OO<	**r   c                    |                                   t          |          ryt          j        |          }|| j        k    rt          d          |dk     r
|| j        z  }|                     ||dz   d          \  }}}|                     |||          d         S t          |t                    rA|                     |j
        |j        |j                  \  }}}|                     |||          S t          |          t          t          fv st          |t           j                  r*|                     |          }|                     |          S t          d|          )a  Get a row or a range of rows from the array.

        If key argument is an integer, the corresponding array row is returned
        as an object of the current flavor.  If key is a slice, the range of
        rows determined by it is returned as a list of objects of the current
        flavor.

        In addition, NumPy-style point selections are supported.  In
        particular, if key is a list of row coordinates, the set of rows
        determined by it is returned.  Furthermore, if key is an array of
        boolean values, only the coordinates where key is True are returned.
        Note that for the latter to work it is necessary that key list would
        contain exactly as many rows as the array has.

        Examples
        --------

        ::

            a_row = vlarray[4]
            a_list = vlarray[4:1000:2]
            a_list2 = vlarray[[0,2]]   # get list of coords
            a_list3 = vlarray[[0,-2]]  # negative values accepted
            a_list4 = vlarray[numpy.array([True,...,False])]  # array of bools

        zIndex out of ranger   r   Invalid index or slice: )r   r   operatorindexr   
IndexErrorr   r   r@   slicer   r   r   rF   listrD   rB   ndarray_point_selection_read_coordinates)r   keyr   r   r   coordss         r   __getitem__zVLArray.__getitem__o  sZ   8 	#;; 	A.%%C dj   !5666Qwwtz!"&"5"5c37A"F"FUD$99UD$//22U## 		A $ 3 3	38SX!/ !/E499UD$///#YY4-'':c2:+F+F'**3//F))&111???@@@r   c                    t          ||          D ]b\  }}|| j        k    rt          d          |dk     r
|| j        z  }|}| j        }t	          |d          s|                    |          }|j        }n|}t          ||          }|                     |          }t          |          }| 
                    ||dz   d          d         }	t          |	          }t          |          |k    r#t          dt          |          d|d          	 ||	dd<   n6# t          $ r)}
t          d	|d
|d|	dd         d|
d	          d}
~
ww xY w|	j        dk    r|                     ||	|           ddS )z8Assign the `values` to the positions stated in `coords`.zFirst index out of ranger   ra   r   zLength of value (z,) is larger than number of elements in row ()NzValue parameter:
'z='
cannot be converted into an array object compliant vlarray[z	] row: 
'z'
The error was: <>)zipr   r   r   re   r   rf   r   r   r   _read_arrayrG   rH   	Exceptionra   _modify)r   r   valuesr>   valueobject_r   r   r   r   excs              r   _assign_valueszVLArray._assign_values  s    vv.. $	4 $	4KD%tz!! !;<<<axx
"G9D4(( ,,w//&w77E((//H  D$$T4!8Q77:E5zzH5zzH$$ j>A%jjjj>Fhh"H I I IJ aaa J J J j ;@%%:?(((CCC	"I J J JJ zA~~T5(333I$	4 $	4s   D
E%$E		Ec                    |                                   | j                                         t          |          r|g}|g}nt	          |t
                    r<|                     |j        |j        |j	                  \  }}}t          |||          }n_t          |          t          t          fv st	          |t          j                  r|                     |          }nt#          d|          |                     ||           dS )aN  Set a row, or set of rows, in the array.

        It takes different actions depending on the type of the *key*
        parameter: if it is an integer, the corresponding table row is
        set to *value* (a record or sequence capable of being converted
        to the table structure).  If *key* is a slice, the row slice
        determined by it is set to *value* (a record array or sequence
        of rows capable of being converted to the table structure).

        In addition, NumPy-style point selections are supported.  In
        particular, if key is a list of row coordinates, the set of rows
        determined by it is set to value.  Furthermore, if key is an array of
        boolean values, only the coordinates where key is True are set to
        values from value.  Note that for the latter to work it is necessary
        that key list would contain exactly as many rows as the table has.

        .. note::

            When updating the rows of a VLArray object which uses a
            pseudo-atom, there is a problem: you can only update values
            with *exactly* the same size in bytes than the original row.
            This is very difficult to meet with object pseudo-atoms,
            because :mod:`pickle` applied on a Python object does not
            guarantee to return the same number of bytes than over another
            object, even if they are of the same class.
            This effectively limits the kinds of objects than can be
            updated in variable-length arrays.

        Examples
        --------

        ::

            vlarray[0] = vlarray[0] * 2 + 3
            vlarray[99] = arange(96) * 2 + 3

            # Negative values for the index are supported.
            vlarray[-99] = vlarray[5] * 2 + 3
            vlarray[1:30:2] = list_of_rows
            vlarray[[1,3]] = new_1_and_3_rows

        r   N)r   r1   r   r   r@   r   r   r   r   r   rangerF   r   rD   rB   r   r   r   r   )r   r   r   r   r   r   r   s          r   __setitem__zVLArray.__setitem__  s	   X 	$$&&&#;; 	AUFGEEU## 	A $ 3 3	38SX!/ !/E45$--FF#YY4-'':c2:+F+F'**3//FF???@@@ 	FE*****r   r   c                    |                                   |                     |||          \  }}}||k    rg }n|                     |||          }| j        t	          d          sfd|D             }n| j        fd|D             }|S )a  Get data in the array as a list of objects of the current flavor.

        Please note that, as the lengths of the different rows are variable,
        the returned value is a *Python list* (not an array of the current
        flavor), with as many entries as specified rows in the range
        parameters.

        The start, stop and step parameters can be used to select only a
        *range of rows* in the array.  Their meanings are the same as in
        the built-in range() Python function, except that negative values
        of step are not allowed yet. Moreover, if only start is specified,
        then stop will be set to start + 1. If you do not specify neither
        start nor stop, then *all the rows* in the array are selected.

        ra   c                 :    g | ]}                     |          S  )	fromarray)r*   arrr   s     r   
<listcomp>z VLArray.read.<locals>.<listcomp>&  s%    AAA#$..--AAAr   c                 0    g | ]}t          |          S r   r   )r*   r   flavors     r   r   z VLArray.read.<locals>.<listcomp>*  s$    MMMc,S&99MMMr   )r   _process_range_readr   r   re   r   )r   r   r   r   r=   
outlistarrr   r   s         @@r   r   zVLArray.read  s    " 	 44UD$GGtTD==GG&&udD99GytV$$ 	NAAAAAAAJJ [FMMMMWMMMJr   c           	          g }|D ]O}|                     |                     t          |          t          |          dz   d          d                    P|S )z Read rows specified in `coords`.r   r   )r   r   rA   )r   r   rowscoords       r   r   zVLArray._read_coordinates-  sW     	E 	EEKK		#e**c%jj1na@@CDDDDr   c
           
         t          ||| j        ||| j        ||	          }d}|                     |||          \  }}}t	          d          }d}t          | j        d          s| j        j        j        }n| j        j        }t          ||||z            D ]`}|||z  z   }||k    r|}| 	                    |||          d         }|j
        d         }|                    ||           |||z  z  }|dz  }a||_        ||fS )z2Private part of Leaf.copy() for each kind of leaf.)rM   rN   rO   rP   rR   r   r   ra   )r   r   r   )r   r   r3   r   r   re   rf   ra   r   r   r   r   r   )r   grouprL   r   r   r   rM   rN   rP   rR   kwargsrw   rY   nrowscopiednbytesatomsizestart2stop2r   r   s                       r   _g_copy_with_statszVLArray._g_copy_with_stats4  s8   
 4%-*   
"66udDIIdqkkty&)) 	&y~*HHy~HE4
):;; 		 		FTJ..Et||$$6D$II!LE{1~HNN5(+++h))F1KK"r   c           	      J    |  d| j         d| j        d| j         d| j        	S )z;This provides more metainfo in addition to standard __str__z

  atom = z
  byteorder = z
  nrows = z
  flavor = )r   rQ   r   r   r   s    r   __repr__zVLArray.__repr__Y  sV       
) ~  :  K	  	r   )Nr&   NNNNTT)NNN)NNr   )__name__
__module____qualname____doc__
_c_classidr   r   propertyr   r"   r%   rJ   rX   r_   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __classcell__)rU   s   @r   r   r      s        p pf J  X   X O O XO ' ' X'$ ;=,0,0(,Z7 Z7 Z7 Z7 Z7 Z7x    
' ' '8)  )  ) V     8# # #J  $ $ $L   >  :7 7 7+ + +.1A 1A 1Af'4 '4 '4R>+ >+ >+B   B  #  #  # J      r   r   )r   r   rl   numpyrB   r&   r   r   r   r   r   r   r	   leafr
   r   utilsr   r   r   r   r   r   r   rb   r   r   r   r   <module>r      s'   ( (  



           9 9 9 9 9 9 9 9 9 9 & & & & & & & & & & & & & &                                    	G G G G Gm#T G G G G Gr   