ó
¾÷Xc           @@  s˜  d  Z  d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l	 Z	 d d l
 m Z m Z m Z m Z m Z m Z 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 d d l m Z e e  d ƒ ƒ Z! e j" ƒ  j# Z$ d „  Z% d d d d d d d d d d d d d „ Z' d e( f d „  ƒ  YZ) e$ r~d e( f d „  ƒ  YZ* n  d e f d „  ƒ  YZ+ d S(   s7   
    Implements support for high-level dataset access.
i    (   t   absolute_importN(   t   xrangei   (   t   h5t   h5st   h5tt   h5rt   h5dt   h5pt   h5fdi   (   t   HLObjectt   philt	   with_philt   Emptyt   is_empty_dataspace(   t   filters(   t
   selections(   t   selections2(   t   Datatypei
   c         C@  s˜   t  | ƒ d k r |  S|  j d k r4 t d ƒ ‚ n  x0 | D]( } | |  j k r; t d | ƒ ‚ q; q; Wt j g  | D] } | |  j | d f ^ qt ƒ S(   s,    Make a NumPy dtype appropriate for reading i    s+   Field names only allowed for compound typess&   Field %s does not appear in this type.N(   t   lent   namest   Nonet
   ValueErrort   numpyt   dtypet   fields(   t   basetypeR   t   name(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   readtime_dtype"   s    c         C@  sÃ  | d k	 rS t | t ƒ rS d d l m } t j | d d d | j | ƒ ƒ} n  | d k r¡ | d k r• | d k r† t d ƒ ‚ n  t | ƒ } n  | j	 } nH t
 | ƒ } | d k	 ré t j | ƒ t j | j	 ƒ k ré t d ƒ ‚ n  | d k	 rû | n | } t | t
 ƒ rPt d „  t | | ƒ Dƒ ƒ rPd	 j | | ƒ } t | ƒ ‚ n  t | t ƒ rt| j } | j } nr | d k rž| d k ržt j d
 ƒ } n3 | d k rÂ| d k	 rÂ| j } n t j | ƒ } t j | d d ƒ} t | | | | | f ƒ r| t k rt d ƒ ‚ n  | t k rF|	 d k r=d }	 n  d } n  | t k r||	 d k	 rmt d ƒ ‚ n  | }	 d } n  t j | | | | |	 | | | | ƒ	 } |
 d k	 rÎt j |
 ƒ }
 | j |
 ƒ n  | t t f k rð| j | ƒ n | d k	 rt d ƒ ‚ n  | d k	 r0t
 d „  | Dƒ ƒ } n  t | t ƒ rTt j t j ƒ } n t j  | | ƒ } t! j |  j d | | d | ƒ} | d k	 r¿t | t ƒ r¿| j" t j# t j# | ƒ n  | S(   sU    Return a new low-level dataset identifier

    Only creates anonymous datasets.
    i   (   t   baset   ordert   CR   s-   One of data, shape or dtype must be specifieds%   Shape tuple is incompatible with datac         s@  s-   |  ]# \ } } | d  k	 r | | k Vq d  S(   N(   R   (   t   .0t   dimt   chunk(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>O   s    s^   Chunk shape must not be greater than data shape in any dimension. {} is not compatible with {}s   =f4t   logicals1   Chunked format required for given storage optionsi   t   gzips   Conflict in compression optionss(   track_times must be either True or Falsec         s@  s*   |  ]  } | d  k	 r | n t j Vq d  S(   N(   R   R   t	   UNLIMITED(   R   t   m(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>   s    t   dcplN($   R   t
   isinstanceR   t    R   R   t   asarrayt   guess_dtypet	   TypeErrort   shapet   tuplet   productR   t   anyt   zipt   formatR   t   idR   R   t	   py_createt   Falset   Truet   _LEGACY_GZIP_COMPRESSION_VALSR   t   generate_dcplt   arrayt   set_fill_valuet   set_obj_track_timesR   t   createt   NULLt   create_simpleR   t   writet   ALL(   t   parentR,   R   t   datat   chunkst   compressiont   shufflet
   fletcher32t   maxshapet   compression_optst	   fillvaluet   scaleoffsett   track_timesR   t	   tmp_shapet   errmsgt   tidR&   t   sidt   dset_id(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   make_new_dset2   sp    
'-	'			!t   AstypeContextc           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sQ   
        Context manager which allows changing the type read from a dataset.
    c         C@  s   | |  _  t j | ƒ |  _ d  S(   N(   t   _dsetR   R   t   _dtype(   t   selft   dsetR   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __init__—   s    	c         C@  s   |  j  |  j j _ d  S(   N(   RS   RR   t   _localt   astype(   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt	   __enter__›   s    c         G@  s   d  |  j j _ d  S(   N(   R   RR   RW   RX   (   RT   t   args(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __exit__Ÿ   s    (   t   __name__t
   __module__t   __doc__RV   RY   R[   (    (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRQ   ‘   s   		t   CollectiveContextc           B@  s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   s$    Manages collective I/O in MPI mode c         C@  s   | |  _  d  S(   N(   RR   (   RT   RU   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRV   ª   s    c         C@  s   |  j  j j t j ƒ d  S(   N(   RR   t   _dxplt   set_dxpl_mpioR   t   MPIO_COLLECTIVE(   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRY   ­   s    c         G@  s   |  j  j j t j ƒ d  S(   N(   RR   R`   Ra   R   t   MPIO_INDEPENDENT(   RT   RZ   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR[   ±   s    (   R\   R]   R^   RV   RY   R[   (    (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR_   ¤   s   		t   Datasetc           B@  sZ  e  Z d  Z d „  Z e r3 e e d „  ƒ ƒ Z n  e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z	 e e d „  ƒ ƒ Z
 e
 j e d „  ƒ ƒ Z
 e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d	 „  ƒ ƒ Z e e d
 „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e e d „  ƒ ƒ Z e d „  ƒ Z d! d „ Z e d „  ƒ Z d „  Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d! d! d „ Z d! d! d „ Z  e d! d „ ƒ Z! e d „  ƒ Z" e# e$ j% d ƒ r4e d „  ƒ Z& n  e# e$ j% d ƒ rXe d  „  ƒ Z' n  RS("   s(   
        Represents an HDF5 dataset
    c         C@  s   t  |  | ƒ S(   sÈ    Get a context manager allowing you to perform reads to a
        different destination type, e.g.:

        >>> with dataset.astype('f8'):
        ...     double_precision = dataset[0:100:2]
        (   RQ   (   RT   R   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRX   »   s    c         C@  s
   t  |  ƒ S(   s3    Context manager for MPI collective reads & writes (   R_   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt
   collectiveÅ   s    c         C@  s   d d l  m } | |  ƒ S(   s3    Access dimension scales attached to this dataset. i   (   t   DimensionManager(   t   dimsRf   (   RT   Rf   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRg   Ì   s    c         C@  s
   |  j  j S(   s5   Numpy-style attribute giving the number of dimensions(   R2   t   rank(   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   ndimÓ   s    c         C@  s
   |  j  j S(   s1   Numpy-style shape tuple giving dataset dimensions(   R2   R,   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR,   Ù   s    c         C@  s   |  j  | ƒ d  S(   N(   t   resize(   RT   R,   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR,   Þ   s    c         C@  s   t  j |  j ƒ S(   s3   Numpy-style attribute giving the total dataset size(   R   t   prodR,   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   sizeä   s    c         C@  s
   |  j  j S(   s%   Numpy dtype representing the datatype(   R2   R   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR   ê   s    c         C@  s   t  d ƒ |  d S(   s     Alias for dataset[()] s;   dataset.value has been deprecated. Use dataset[()] instead.(    (   t   DeprecationWarning(   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   valueð   s    
c         C@  s,   |  j  } | j ƒ  t j k r( | j ƒ  Sd S(   s   Dataset chunks (or None)N(   t   _dcplt
   get_layoutR   t   CHUNKEDt	   get_chunkR   (   RT   R&   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRB   ø   s    	
c         C@  s(   x! d D] } | |  j  k r | Sq Wd S(   s   Compression strategy (or None)R#   t   lzft   szip(   s   gzipRs   Rt   N(   t   _filtersR   (   RT   t   x(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRC     s    c         C@  s   |  j  j |  j d ƒ S(   s<    Compression setting.  Int(0-9) for gzip, 2-tuple for szip. N(   Ru   t   getRC   R   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRG   
  s    c         C@  s   d |  j  k S(   s   Shuffle filter present (T/F)RD   (   Ru   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRD     s    c         C@  s   d |  j  k S(   s"   Fletcher32 filter is present (T/F)RE   (   Ru   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRE     s    c         C@  s,   y |  j  d d SWn t k
 r' d SXd S(   s  Scale/offset filter settings. For integer data types, this is
        the number of bits stored, or 0 for auto-detected. For floating
        point data types, this is the number of decimal places retained.
        If the scale/offset filter is not in use, this is None.RI   i   N(   Ru   t   KeyErrorR   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRI     s    c         C@  s2   |  j  j ƒ  } | j t ƒ } t d „  | Dƒ ƒ S(   sc   Shape up to which this dataset can be resized.  Axes with value
        None have no resize limit. c         s@  s*   |  ]  } | t  j k r | n d  Vq d  S(   N(   R   R$   R   (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>/  s    (   R2   t	   get_spacet   get_simple_extent_dimsR5   R-   (   RT   t   spaceRg   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRF   (  s    c         C@  s0   t  j d d |  j ƒ} |  j j | ƒ | d S(   s*   Fill value for this dataset (0 by default)i   R   i    (   i   (   R   t   ndarrayR   Ro   t   get_fill_value(   RT   t   arr(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRH   1  s    c         C@  s   d d l  m } t | t j ƒ s5 t d | ƒ ‚ n  t j |  | ƒ |  j j	 ƒ  |  _
 t j t j ƒ |  _ t j |  j
 ƒ |  _ | ƒ  |  _ d |  j _ d S(   sJ    Create a new Dataset object by binding to a low-level DatasetID.
        i    (   t   locals   %s is not a DatasetIDN(   t	   threadingR   R'   R   t	   DatasetIDR   R	   RV   R2   t   get_create_plistRo   R   R;   t   DATASET_XFERR`   R   t   get_filtersRu   RW   R   RX   (   RT   t   bindR   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRV   9  s    c      
   C@  sÞ   t  Ò |  j d k r% t d ƒ ‚ n  | d k	 r¸ | d k oL | |  j j k  sl t d |  j j d ƒ ‚ n  y t | ƒ } Wn t k
 r› t d ƒ ‚ n Xt |  j	 ƒ } | | | <n  t
 | ƒ } |  j j | ƒ Wd QXd S(   sE   Resize the dataset, or the specified axis.

        The dataset must be stored in chunked format; it can be resized up to
        the "maximum shape" (keyword maxshape) specified at creation time.
        The rank of the dataset cannot be changed.

        "Size" should be a shape tuple, or if an axis is specified, an integer.

        BEWARE: This functions differently than the NumPy resize() method!
        The data is not "reshuffled" to fit in the new shape; each axis is
        grown or shrunk independently.  The coordinates of existing data are
        fixed.
        s$   Only chunked datasets can be resizedi    s   Invalid axis (0 to %s allowed)i   s2   Argument must be a single int if axis is specifiedN(   R
   RB   R   R+   R2   Rh   R   t   intt   listR,   R-   t
   set_extent(   RT   Rl   t   axist   newlen(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRj   I  s    c         C@  s.   |  j  ƒ  } | t j k r* t d ƒ ‚ n  | S(   s„    The size of the first axis.  TypeError if scalar.

        Limited to 2**32 on 32-bit systems; Dataset.len() is preferred.
        s>   Value too big for Python's __len__; use Dataset.len() instead.(   R   t   syst   maxsizet   OverflowError(   RT   Rl   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __len__i  s    c         C@  sC   t  7 |  j } t | ƒ d k r1 t d ƒ ‚ n  | d SWd QXd S(   sÐ    The size of the first axis.  TypeError if scalar.

        Use of this method is preferred to len(dset), as Python's built-in
        len() cannot handle values greater then 2**32 on 32-bit systems.
        i    s'   Attempt to take len() of scalar datasetN(   R
   R,   R   R+   (   RT   R,   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyR   t  s
    	c         c@  sR   |  j  } t | ƒ d k r* t d ƒ ‚ n  x! t | d ƒ D] } |  | Vq; Wd S(   sŠ    Iterate over the first axis.  TypeError if scalar.

        BEWARE: Modifications to the yielded data are *NOT* written to file.
        i    s#   Can't iterate over a scalar datasetN(   R,   R   R+   R   (   RT   R,   t   i(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __iter__€  s
    	c      
   C@  s}  t  | t ƒ r | n | f } t |  j ƒ rg | t ƒ  k pH | t f k sZ t d ƒ ‚ n  t |  j ƒ St d „  | Dƒ ƒ } t d „  | Dƒ ƒ } t j	 rµ t d „  | Dƒ ƒ } n  t
 |  j d d ƒ } | d k	 rè t | | ƒ } n t |  j j | ƒ } t j | ƒ } t | ƒ d k r%t  | d t j ƒ r%t j | d |  j ƒ } | |  j k rkt d ƒ ‚ n  t j | d |  j ƒ } t j | ƒ } | d k r²t j d d	 | ƒSt j | ƒ d k rÚt j | d	 | ƒSt j | d	 | ƒ} t j | ƒ }	 |	 j ƒ  |  j j |	 | | | ƒ | St j |  j ƒ d k rt| t f k s[| t ƒ  k rtt j |  j d	 | ƒSn  |  j d k r*|  j j  ƒ  }
 t! j" |
 | ƒ } t j# | j$ d	 | ƒ} x- | D]% \ } }
 |  j j | |
 | | ƒ qÃWt | ƒ d k r| | d } n  | j$ d k r&| d S| St j% |  j | d
 |  j ƒ} | j& d k rmt j# | j$ d	 | ƒS| j$ d k } | rˆd n | j$ } t j# | | d d ƒ} t | ƒ t |  j ƒ k  rèd t |  j ƒ t | ƒ | } n  t j | ƒ } | j }
 |  j j | |
 | | d |  j' ƒt | ƒ d k rE| | d } n  | j d k rft j( | ƒ } n  | ry| d } n  | S(   s   Read a slice from the HDF5 dataset.

        Takes slices and recarray-style field names (more than one is
        allowed!) in any order.  Obeys basic NumPy rules, including
        broadcasting.

        Also supports:

        * Boolean "mask" array indexing
        s   Empty datasets cannot be slicedc         s@  s'   |  ] } t  | t j ƒ r | Vq d  S(   N(   R'   t   sixt   string_types(   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>   s    c         s@  s'   |  ] } t  | t j ƒ s | Vq d  S(   N(   R'   R‘   R’   (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>¡  s    c         s@  s6   |  ], } t  | t j ƒ r* | j d  ƒ n | Vq d S(   s   utf-8N(   R'   R‘   t	   text_typet   encode(   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>£  s    RX   i   i    s+   Region reference must point to this datasetR   t   dsidR   R   t   dxplN(   i    (    (    (    (   i   (   i   (    ()   R'   R-   R   R2   t   EllipsisR   R   R   R‘   t   PY2t   getattrRW   R   R   R   R3   R   R   t   RegionReferencet   dereferencet
   get_regiont   selt   guess_shapeR   R8   R.   t   emptyR   R=   t
   select_allt   readR,   Ry   t   sel2t   select_readR|   t   mshapet   selectt   nselectR`   t   asscalar(   RT   RZ   R   t	   new_dtypet   mtypet   objRN   R¤   t   outt   sid_outt   fspacet	   selectionR~   t   mspacet   single_element(    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __getitem__  sz    	(
$	"c         C@  s  t  | t ƒ r | n | f } t d „  | Dƒ ƒ } t d „  | Dƒ ƒ } t j rl t d „  | Dƒ ƒ } n  t j d |  j ƒ } | d k	 rÕ| t t j	 f k rÕy t
 j | d | ƒ} Wnc t k
 r y> t
 j g  | D] } t
 j | d | ƒ^ qÛ d |  j ƒ} Wq!t k
 rq!Xn X| | j k rA| j d k r§t
 j d | j d  d t ƒ } g  | j t
 j | j d  ƒ | j d f ƒ D] } | ^ q‹| j ƒ  (n" t
 j d g d t ƒ} | | d	 <| } qAnl|  j j d
 k s0|  j j d k r,t  | t
 j ƒ s| j j d k r,|  j j d k r,t | ƒ d k r¢|  j j d k	 r¢| d	 |  j j k rt d | d	 ƒ ‚ n  |  j j | d	 d	 } t }	 n |  j } t }	 t
 j | d | j d d ƒ} |	 rA| j t
 j | d	 | f g ƒ ƒ } | j | j t | j ƒ t | j ƒ  ƒ } qAn t
 j | d d ƒ} |  j j d k	 rã|  j j d }
 | j t |
 ƒ } | |
 k rœt d | |
 f ƒ ‚ n  t j t
 j | j |
 f ƒ ƒ } | j d	 t | j ƒ t |
 ƒ !} nÏt | ƒ d	 k r£| j } |  j j d k rt d ƒ ‚ n  g  | D] } | |  j j k r&| ^ q&} t | ƒ d	 k rˆd j  d „  | Dƒ ƒ } t d | ƒ ‚ n  t | ƒ d k rü| j j d k rüt j | j ƒ } t j! t j" | j# ƒ  ƒ } | j$ |  j% | d	 ƒ d	 | ƒ q²g  | j j& D] } | | k r	| ^ q	} t j! t j" | j j' ƒ } xm | D]S } t j | j j | d	 ƒ } | j j | d } | j$ |  j% | ƒ | | ƒ qIWn | j } d } t( j) |  j | d |  j* ƒ} | j+ d	 k rãd S| d k rZ| j, d k rZ|  j j d k	 rt d ƒ ‚ n  t
 j | j, d d | j ƒ} | | d <| } | j } n  t | ƒ t |  j ƒ k  r™d t |  j ƒ t | ƒ | } n | } t- j. | t- j/ f t | ƒ ƒ } x9 | j0 | ƒ D]( } |  j* j1 | | | | d |  j2 ƒqÑWd S(   sÔ    Write to the HDF5 dataset from a Numpy array.

        NumPy's broadcasting rules are honored, for "simple" indexing
        (slices and integers).  For advanced indexing, the shapes must
        match.
        c         s@  s'   |  ] } t  | t j ƒ r | Vq d  S(   N(   R'   R‘   R’   (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>  s    c         s@  s'   |  ] } t  | t j ƒ s | Vq d  S(   N(   R'   R‘   R’   (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>  s    c         s@  s6   |  ], } t  | t j ƒ r* | j d  ƒ n | Vq d S(   s   utf-8N(   R'   R‘   R“   R”   (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>  s    t   vlenR   i   R,   iÿÿÿÿi    t   Ot   Vs   No such field for indexing: %sR   R   sW   When writing to array types, last N dimensions have to match (got %s, but should be %s)s1   Illegal slicing argument (not a compound dataset)s   , c         s@  s   |  ] } d  | Vq d S(   s   "%s"N(    (   R   Rv   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pys	   <genexpr>G  s    s8   Illegal slicing argument (fields %s not in dataset type)R•   Ns5   Scalar broadcasting is not supported for array dtypes.R–   (    (    (   i   (3   R'   R-   R‘   R˜   R   t   check_dtypeR   R   t   bytesR“   R   R)   R   R8   Ri   RŸ   R,   t   objectt   reshapeR.   t   ravelt   kindR|   t   subdtypeR   R   R5   R4   R   t   viewR+   R3   t   joinR;   t   COMPOUNDt   get_sizet   insertt   _eR   t   itemsizeR   R¥   R2   R¦   R¤   R   R=   R$   t	   broadcastR>   R`   (   RT   RZ   t   valR   R²   Rv   t   tmpR   R   t   cast_compoundt   shpt   valshpR©   R¤   t   mismatcht   subtypet
   fieldnamest	   fieldnamet   offsetR®   t   val2t
   mshape_padR¯   R­   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __setitem__ú  s¤    	!	5	@
%$		%2!&	+$#+#	
$"c         C@  sì   t  à t |  j ƒ r% t d ƒ ‚ n  | d k rF t j |  j ƒ } n t j |  j | |  j ƒ } | j } | d k r‹ t j | j ƒ } n t j | j | |  j ƒ } x9 | j	 | j
 ƒ D]% } |  j j | | | d |  j ƒq¹ WWd QXd S(   sù    Read data directly from HDF5 into an existing NumPy array.

        The destination array must be C-contiguous and writable.
        Selections must be the output of numpy.s_[<args>].

        Broadcasting is supported for simple indexing.
        s+   Empty datasets have no numpy representationR–   N(   R
   R   R2   R+   R   R   t   SimpleSelectionR,   R¥   RÃ   R¤   R¡   R`   (   RT   t   destt
   source_selt   dest_selR­   R¯   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   read_directx  s    	c         C@  sì   t  à t |  j ƒ r% t d ƒ ‚ n  | d k rF t j | j ƒ } n t j | j | |  j ƒ } | j } | d k r‹ t j |  j ƒ } n t j |  j | |  j ƒ } x9 | j	 | j
 ƒ D]% } |  j j | | | d |  j ƒq¹ WWd QXd S(   sÝ    Write data directly to HDF5 from a NumPy array.

        The source array must be C-contiguous.  Selections must be
        the output of numpy.s_[<args>].

        Broadcasting is supported for simple indexing.
        s#   Empty datasets cannot be written toR–   N(   R
   R   R2   R+   R   R   RÑ   R,   R¥   RÃ   R¤   R>   R`   (   RT   t   sourceRÓ   RÔ   R¯   R­   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   write_direct‘  s    	c         C@  sZ   t  j |  j d | d k r$ |  j n | ƒ} t  j |  j ƒ d k rI | S|  j | ƒ | S(   sá    Create a Numpy array containing the whole dataset.  DON'T THINK
        THIS MEANS DATASETS ARE INTERCHANGABLE WITH ARRAYS.  For one thing,
        you have to read the whole dataset everytime this method is called.
        R   i    N(   R   RŸ   R,   R   R   R.   RÕ   (   RT   R   R~   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt	   __array__ª  s
    -c         C@  sÊ   |  s t  j d ƒ } n˜ |  j d  k r9 t  j d ƒ } nR t j t j |  j ƒ ƒ } t  j d ƒ | t  j d ƒ k r{ | n t  j d ƒ } t  j d ƒ | |  j |  j j	 f } t  j
 rÆ | j d ƒ S| S(   Ns   <Closed HDF5 dataset>s   ("anonymous")s   "%s"R(   t   /s&   <HDF5 dataset %s: shape %s, type "%s">t   utf8(   R‘   t   uR   R   t   ppt   basenamet   normpathR,   R   t   strR˜   R”   (   RT   t   rt   namestrR   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   __repr__¹  s    +	t   refreshc         C@  s   |  j  j ƒ  d S(   sÆ    Refresh the dataset metadata by reloading from the file.
            
            This is part of the SWMR features and only exist when the HDF5
            librarary version >=1.9.178
            N(   t   _idRã   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRã   Ë  s    t   flushc         C@  s   |  j  j ƒ  d S(   s   Flush the dataset data and metadata to the file.
            If the dataset is chunked, raw data chunks are written to the file.
            
            This is part of the SWMR features and only exist when the HDF5 
            librarary version >=1.9.178
            N(   Rä   Rå   (   RT   (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRå   Õ  s    N((   R\   R]   R^   RX   t   MPIt   propertyR   Re   Rg   Ri   R,   t   setterRl   R   Rn   RB   RC   RG   RD   RE   RI   RF   RH   RV   R   Rj   RŽ   R   R   R±   RÐ   RÕ   R×   RØ   Râ   t   hasattrR   R   Rã   Rå   (    (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyRd   µ   sf   		 	m~	(,   R^   t
   __future__R    t	   posixpathRÜ   R‹   R‘   t	   six.movesR   R   R(   R   R   R   R   R   R   R   R   R	   R
   R   R   R   R   R   R   R   R¢   t   datatypeR   t	   frozensett   rangeR6   t
   get_configt   mpiRæ   R   R   RP   R·   RQ   R_   Rd   (    (    (    s.   /tmp/pip-build-isqEY4/h5py/h5py/_hl/dataset.pyt   <module>   s.   4(				\