ó
\c           @   så   d  Z  d d l m Z d d l m Z d d l m Z m Z d d l m	 Z	 m
 Z
 d d l m Z d	 e d	 d ƒ f d „  ƒ  YZ e Z e j d d !Z e e
 j ƒ  j k rµ e Z n  d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   s=   
    High-level interface for creating HDF5 virtual datasets
iÿÿÿÿ(   t   deepcopy(   t
   namedtuplei   (   t   SimpleSelectiont   selecti   (   t   h5st   h5(   t   versiont   VDSmapt   vspacet	   file_namet	   dset_namet	   src_spacec           B   s   e  Z d  Z RS(   sN   Defines a region in a virtual dataset mapping to part of a source dataset
    (   t   __name__t
   __module__t   __doc__(    (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyR      s   i    i   t   VirtualSourcec           B   s;   e  Z d  Z d d d d d „ Z e d „  ƒ Z d „  Z RS(   s­  Source definition for virtual data sets.

    Instantiate this class to represent an entire source dataset, and then
    slice it to indicate which regions should be used in the virtual dataset.

    path_or_dataset
        The path to a file, or an h5py dataset. If a dataset is given,
        the other parameters are ignored, and the relevant values taken from
        the dataset instead.
    name
        The name of the source dataset within the file.
    shape
        A tuple giving the shape of the dataset.
    dtype
        Numpy dtype or string.
    maxshape
        The source dataset is resizable up to this shape. Use None for
        axes you want to be unlimited.
    c         C   sd  d d l  m } t | | ƒ r« d „  i | d 6| d 6| d 6| d 6j ƒ  Dƒ } | rr t d j d	 | ƒ ƒ ‚ n  | } | j j }	 | j } | j	 } | j
 } | j } n< | }	 | d  k rÌ t d
 ƒ ‚ n  | d  k rç t d ƒ ‚ n  |	 |  _ | |  _ | |  _
 | d  k r| |  _ n7 t g  | D]! }
 |
 d  k r?t j n |
 ^ q$ƒ |  _ t | ƒ |  _ d  S(   Ni   (   t   Datasetc         S   s+   i  |  ]! \ } } | d  k	 r | | “ q S(   N(   t   None(   t   .0t   kt   v(    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pys
   <dictcomp>:   s   		t   namet   shapet   dtypet   maxshapesh   If a Dataset is passed as the first argument then no other arguments may be passed.  You passed {failed}t   faileds?   The name parameter is required when specifying a source by paths@   The shape parameter is required when specifying a source by path(   t   datasetR   t
   isinstancet   itemst	   TypeErrort   formatt   filet   filenameR   R   R   R   R   t   patht   tupleR   t	   UNLIMITEDR   t   sel(   t   selft   path_or_datasetR   R   R   R   R   R   t   dsR!   t   ix(    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyt   __init__6   s6    						1c         C   s
   |  j  j S(   N(   R$   t   mshape(   R%   (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyR   \   s    c         C   s+   t  |  ƒ } t |  j | d d  ƒ| _ | S(   Nt   dsid(   t   copyR   R   R   R$   (   R%   t   keyt   tmp(    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyt   __getitem__`   s    N(   R   R   R   R   R)   t   propertyR   R/   (    (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyR   "   s
   %t   VirtualLayoutc           B   s&   e  Z d  Z d d d „ Z d „  Z RS(   sW  Object for building a virtual dataset.

    Instantiate this class to define a virtual dataset, assign to slices of it
    (using VirtualSource objects), and then pass it to
    group.create_virtual_dataset() to add the virtual dataset to a file.

    This class does not allow access to the data; the virtual dataset must
    be created in a file before it can be used.

    shape
        A tuple giving the shape of the dataset.
    dtype
        Numpy dtype or string.
    maxshape
        The source dataset is resizable up to this shape. Use None for
        axes you want to be unlimited.
    c         C   s(   | |  _  | |  _ | |  _ g  |  _ d  S(   N(   R   R   R   t   sources(   R%   R   R   R   (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyR)   w   s    			c         C   sJ   t  |  j | d d  ƒ} |  j j t | j | j | j | j	 j ƒ ƒ d  S(   NR+   (
   R   R   R   R2   t   appendR   t   idR!   R   R$   (   R%   R-   t   sourceR$   (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyt   __setitem__}   s
    N(   R   R   R   R   R)   R6   (    (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyR1   e   s   N(   R   R	   R
   R   (   R   R,   R    t   collectionsR   t
   selectionsR   R   t    R   R   R   R   t   Falset   vds_supportt   hdf5_version_tuplet   hdf5_versiont
   get_configt   vds_min_hdf5_versiont   Truet   objectR   R1   (    (    (    s+   lib/python2.7/site-packages/h5py/_hl/vds.pyt   <module>   s   		C