
    E0j                     t    d dl Zd dlmc mZ d dlmZ erd dlm	Z	 ddde
ddfdZd	ed
dddfdZdedefdZdS )    N)TYPE_CHECKING)	TestGroupgroupr   itemsreturnc                    | j         rt          | j         d         j                  sdS d |D             }| j         d         j        }t          ||          }||d         k    rTt	          | j                   D ]?}|j        |v r4| j                            |           | j                             |           @| j         rt          | j         d         j                  sdS | j         d         j        }t          ||          }||d         k    rTt	          | j                  D ]A}|j        |v r4| j                            |           | j                             |           @dS dS )a  
    Ensures that group doesn't contain partial IPy notebook cells.

    ``pytest-split`` might, in principle, break up the cells of an
    IPython notebook into different test groups, in which case the tests
    most likely fail (for starters, libraries are imported in Cell 0, so
    all subsequent calls to the imported libraries in the following cells
    will raise ``NameError``).

    r   Nc                     g | ]	}|j         
S  )nodeid).0items     h/home/rurouni/.hermes/hermes-agent/venv/lib/python3.11/site-packages/pytest_split/ipynb_compatibility.py
<listcomp>z.ensure_ipynb_compatibility.<locals>.<listcomp>   s    333TT[333    )selected_is_ipy_notebookr   _find_sibiling_ipynb_cellslist
deselectedappendremove)r   r   item_node_idsfirstsiblingsr   lasts          r   ensure_ipynb_compatibilityr      s    > !1%.2C2J!K!K 33U333M N1$E)%??H(( 	, 	,D{h&& ''---%%d+++> !1%.2D2K!L!L  >"$D)$>>Hx|)** 	, 	,D{h&& ''---%%d+++	 	, 	,r   ipynb_node_idr   z	list[str]c                 V    |                      d          d         fd|D             S )zE
    Returns all sibling IPyNb cells given an IPyNb cell nodeid.
    ::r   c                     g | ]}|v |	S r
   r
   )r   r   fpaths     r   r   z._find_sibiling_ipynb_cells.<locals>.<listcomp>4   s    <<<TetmmDmmmr   )split)r   r   r"   s     @r   r   r   -   s7     %%a(E<<<<]<<<<r   node_idc                 b    |                      d          d         }|                    d          S )zJ
    Returns True if node_id is an IPython notebook, otherwise False.
    r    r   z.ipynb)r#   endswith)r$   r"   s     r   r   r   7   s,     MM$"E>>(###r   )builtins@py_builtins_pytest.assertion.rewrite	assertionrewrite
@pytest_artypingr   pytest_split.algorithmsr   r   r   strr   boolr   r
   r   r   <module>r1      s                              2111111#,k #,$ #,4 #, #, #, #,L=='2== = = =$c $d $ $ $ $ $ $r   