
    ic
                    n    S r SSKJr  SSKJr  SSKrSSKJr  SSKrSSK	Jr
  SSKJrJr   " S S \5      rg)		SliceSpan    )annotations)datetimeN)Iterable   )ExecutionSpan	ShapeTypec                     ^  \ rS rSrSr      S
U 4S jjrSS jr\SS j5       r\SS j5       r	SS jr
SS jrS	rU =r$ )r      a  An :class:`~.ExecutionSpan` for data stored in a sliceable format.

This type of execution span references pub result data by assuming that it is a sliceable
portion of the (row major) flattened data. Therefore, for each pub dependent on this span, the
constructor accepts a single :class:`slice` object, along with the corresponding shape of the
data to be sliced.

Args:
    start: The start time of the span, in UTC.
    stop: The stop time of the span, in UTC.
    data_slices: A map from pub indices to pairs ``(shape_tuple, slice)``.
c                0   > [         TU ]  X5        X0l        g N)super__init___data_slices)selfstartstopdata_slices	__class__s       f/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_ibm_runtime/execution_span/slice_span.pyr   SliceSpan.__init__)   s     	%'    c                    [        U[        5      =(       aY    U R                  UR                  :H  =(       a9    U R                  UR                  :H  =(       a    U R                  UR                  :H  $ r   )
isinstancer   r   r   r   )r   others     r   __eq__SliceSpan.__eq__/   sT    %+ 
JJ%++% 8		UZZ'8!!U%7%77	
r   c                ,    [        U R                  5      $ r   )sortedr   )r   s    r   pub_idxsSliceSpan.pub_idxs6   s    d''((r   c           	         SnU R                   R                  5        H3  u  p#U[        [        [        R
                  " U5      5      U   5      -  nM5     U$ )Nr   )r   valueslenrangemathprod)r   sizeshapesls       r   r(   SliceSpan.size:   sI    **113IECdii./344D 4r   c                    XR                   ;  a  [        SU S35      eU R                   U   u  p#[        R                  " U[        R                  S9nSUR                  5       U'   U$ )NzPub z is not included in the span.)dtypeT)r   KeyErrornpzerosbool_ravel)r   pub_idxr)   r*   masks        r   r4   SliceSpan.maskA   s^    +++T'*GHII%%g.	xxRXX.

Rr   c                    [        U[        5      (       a  U1O
[        U5      nU R                  R	                  5        VVs0 s H  u  p#X!;   d  M  X#_M     nnn[        U R                  U R                  U5      $ s  snnf r   )r   intsetr   itemsr   r   r   )r   r3   idxvalslicess        r   filter_by_pubSliceSpan.filter_by_pubJ   sg    )'3777)S\+/+<+<+B+B+DW+Dxs(#(+DWTYY77 Xs   A:A:)r   )r   r   r   r   r   z"dict[int, tuple[ShapeType, slice]])r   objectreturnbool)r@   z	list[int])r@   r7   )r3   r7   r@   znpt.NDArray[np.bool_])r3   zint | Iterable[int]r@   z'SliceSpan')__name__
__module____qualname____firstlineno____doc__r   r   propertyr    r(   r4   r=   __static_attributes____classcell__)r   s   @r   r   r      sa    ((%-(<^(
 ) )  8 8r   )rF   
__future__r   r   r&   typingr   numpyr/   numpy.typingnptexecution_spanr   r	   r    r   r   <module>rQ      s+     "      428 28r   