HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1780863/root/usr/lib/python3/dist-packages/reportbug/__pycache__/
Upload File :
Current File : //proc/1780863/root/usr/lib/python3/dist-packages/reportbug/__pycache__/hiermatch.cpython-311.pyc
�

�&=d���0�ddlZddlmZdd�Zdd�Zd�ZdS)	�N�)�
exceptionsc�b�|�dS	tj|tjtjz��}n#t$r
t
j�wxYwg}|�)ttt|������}|D]2}|�
||��r|�|���3|S)am
    Use the pattern_str to find any match in a list of strings

    This is a helper function for :func:`egrep_hierarchy`.

    Note that this function is never called with the `subindex`
    parameter set.

    Parameters
    ----------
    strlist : [str, ...]
        list of strings in which to look for the pattern
    pattern_str : str
        regular expression pattern
    subindex : [int, ...]
        list of indexes of strings in strlist, specifying the elements
        in which to look for the pattern

    Returns
    -------
    [int, ...]
        a list of indexes for the matches in the origin list
    N)�re�compile�I�M�	Exceptionr�InvalidRegex�list�range�len�search�append)�strlist�pattern_str�subindex�pat�
resultlist�is      �5/usr/lib/python3/dist-packages/reportbug/hiermatch.py�
egrep_listr
s���0���t�&��j��b�d�R�T�k�2�2�����&�&�&��%�%�&�����J�����c�'�l�l�+�+�,�,��
�!�!���:�:�g�a�j�!�!�	!����a� � � ���s	�,3�A
c��g}tt|����D]d}|r/||r$t||||||��}ng}nt||||��}|�|���e|S)a�
    Grep the nth item of a hierarchy [(x, [a, b]),...]

    This is a helper function for :func:`matched_hierarchy`.

    Note that this function is never called with the `subhier` and `nth`
    parameters set.

    Parameters
    ----------
    hier : [(str, [str, ...]), (str, [str, ...]), ...]
        list of tuples with severity and bug list
    pattern_str : str
        regular expression pattern
    subhier : [[int, ...], ...], optional
        subhierarchy indices
    nth : int, optional
        should always be 1 (one)

    Returns
    -------
    [[int, ...], [int, ...], ...]
        a subhierarchy (for each severity in the input hierarchy, the
        list of indexes of the bugs matching the pattern_str)
    )r
rrr)�hierr�subhier�nth�
resulthierrrs       r�egrep_hierarchyr3s���4�J�
�3�t�9�9�
�
�	&�	&���	?��q�z�
 �'��Q����k�7�1�:�N�N�
�
��
�
�#�D��G�C�L�+�>�>�J����*�%�%�%�%���c�����g}t�|��}tt|����D]B�|�r8��fd�|�D��}|���d|f���C|S)a�
    Create a new hierarchy from a pattern matching

    Parameters
    ----------
    hier : [(str, [str, ...]), (str, [str, ...]), ...]
        list of tuples with severity and bug list
    pattern_str : str
        regular expression pattern

    Returns
    -------
    [(str, [str, ...]), (str, [str, ...]), ...]
        list of tuples with severity and bug list, only including bugs
        matching the pattern_str
    c�8��g|]}��d|��S)r�)�.0�yrrs  ��r�
<listcomp>z%matched_hierarchy.<locals>.<listcomp>qs%���5�5�5�a�D��G�A�J�q�M�5�5�5rr)rr
rr)rr�mhier�result�itemrs`    @r�matched_hierarchyr)\s�����"
�E�
�T�;�
/�
/�F�
�3�v�;�;�
�
�-�-���!�9�	-�5�5�5�5�5�6�!�9�5�5�5�D��L�L�$�q�'�!�*�d�+�,�,�,���Lr)N)Nr)r�rrrr)r"rr�<module>r+se��
�	�	�	�������&�&�&�&�R&�&�&�&�R����r