
    L-Ph	                    R    d Z ddlmZ ddlmZ ddlmZ ddlmZ dd
Z	ddZ
ddZdS )z"Determine contexts for coverage.py    )annotations)	FrameType)Sequence)TShouldStartContextFncontext_switchersSequence[TShouldStartContextFn]returnTShouldStartContextFn | Nonec                R      sdS t                     dk    r d         S d	 fd}|S )
a  Create a single context switcher from multiple switchers.

    `context_switchers` is a list of functions that take a frame as an
    argument and return a string to use as the new context label.

    Returns a function that composites `context_switchers` functions, or None
    if `context_switchers` is an empty list.

    When invoked, the combined switcher calls `context_switchers` one-by-one
    until a string is returned.  The combined switcher returns None if all
    `context_switchers` return None.
    N   r   framer   r	   
str | Nonec                4    D ]} ||           }||c S dS )z,The combiner for multiple context switchers.N )r   switchernew_contextr   s      P/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/coverage/context.pyshould_start_contextz7combine_context_switchers.<locals>.should_start_context#   s;    ) 	# 	#H"(5//K&"""" 't    r   r   r	   r   )len)r   r   s   ` r   combine_context_switchersr      sW      t
"" ##       r   r   r   r   c                r    | j         j        }|                    d          s|dk    rt          |           S dS )z(Is this frame calling a test_* function?testrunTestN)f_codeco_name
startswithqualname_from_frame)r   r   s     r   "should_start_context_test_functionr    .   s?    l"G&!! *W	%9%9"5)))4r   c                   | j         }|j        }d}|j        r=|j        d         dk    r,| j                            dd          }t          ||d          }|*| j                            |          }|dS |j         d| S t          |dd          }||j	        }|j         d|j
         d| S |j         d|j         S )z5Get a qualified name for the code running in `frame`.Nr   self.__func__)r   r   co_argcountco_varnamesf_localsgetgetattr	f_globals
__module__	__class____name____qualname__)r   cofnamemethodr"   funcclss          r   r   r   6   s    	BJEF	~ ,".+v55~!!&$//ud++~""5))<4/++E+++6:t,,D|n.993<99%999o33 1333r   N)r   r   r	   r
   r   )__doc__
__future__r   typesr   collections.abcr   coverage.typesr   r   r    r   r   r   r   <module>r9      s    ) ( " " " " " "       $ $ $ $ $ $ 0 0 0 0 0 0       @   4 4 4 4 4 4r   