
    1Vh
                     B    d Z ddlZddlmZ d Zd Z G d d      Zd	 Zy)
z7
    Implements a portion of the selection operations.
    N   )h5sc                 `    t        |      dk(  r }nk j                  t        d      t         fd|D              rt        d      t	        j
                  |D cg c]  }| j                  |   d   f c}      }t        |      dk(  r|j                  |d      d   }||fS |}||fS c c}w )z Returns a 2-tuple containing:

    1. Output dataset dtype
    2. Dtype containing HDF5-appropriate description of destination
    r   z+Field names only allowed for compound typesc              3   :   K   | ]  }|j                   v  y wN)names).0xdataset_dtypes     D/home/dcms/DCMS/lib/python3.12/site-packages/h5py/_hl/selections2.py	<genexpr>zread_dtypes.<locals>.<genexpr>   s     9aQm)))9s   z#Field does not appear in this type.   )lenr   
ValueErroranynpdtypefields)r   r   format_dtypenameoutput_dtypes   `    r   read_dtypesr      s     5zQ$				$FGG	959	9>?? xxSX Y4$(<(<T(B1(E!F YZ
5zQ#**584Q7
 %% $%% !Zs   B+c                     | j                   dk7  rt        d      |dk(  rd}n|t        fk(  rd}nt        d      | j	                         }|j                          ||fS )z Returns a 2-tuple containing:

    1. Output dataset shape
    2. HDF5 dataspace containing source selection.

    Works for scalar datasets.
     z1Illegal selection function for non-scalar datasetN-Illegal slicing argument for scalar dataspace)shapeRuntimeErrorEllipsisr   	get_space
select_all)dsidargs	out_shapesource_spaces       r   read_selections_scalarr%   .   sj     zzRNOOrz 		(		 HII>>#Ll""    c                       e Zd ZdZd Zd Zy)ScalarReadSelectionz5
        Implements slicing for scalar datasets.
    c                     |dk(  rd | _         n|t        fk(  rd| _         nt        d      t        j                  t        j
                        | _        || _        y )Nr   r   )mshaper   r   r   createSCALARmspacefspace)selfr.   r"   s      r   __init__zScalarReadSelection.__init__P   sH    2:DKh[ DKLMMjj,r&   c              #   t   K   | j                   j                          | j                  | j                   f y wr   )r-   r    r.   )r/   s    r   __iter__zScalarReadSelection.__iter__[   s)      kk4;;&&s   68N)__name__
__module____qualname____doc__r0   r2   r   r&   r   r(   r(   J   s    	'r&   r(   c                 L    | j                   dk(  rt        | |      S t               )zn Top-level dispatch function for reading.

    At the moment, only supports reading from scalar datasets.
    r   )r   r(   NotImplementedError)r.   r"   s     r   select_readr9   _   s&    
 ||r"6400

r&   )	r6   numpyr    r   r   r%   r(   r9   r   r&   r   <module>r<      s+     &:#8' '* r&   