B
    `                 @   s    d Z dd Zdd Zdd ZdS )z"Determine contexts for coverage.pyc                s,    sdS t  dkr d S  fd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       c                s&   x  D ]}|| }|dk	r|S qW dS )z,The combiner for multiple context switchers.N )frameZswitcherZnew_context)context_switchersr   X/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/coverage/context.pyshould_start_context   s
    
z7combine_context_switchers.<locals>.should_start_context)len)r   r   r   )r   r   combine_context_switchers   s    r	   c             C   s&   | j j}|ds|dkr"t| S dS )z(Is this frame calling a test_* function?testZrunTestN)f_codeco_name
startswithqualname_from_frame)r   r   r   r   r   "should_start_context_test_function%   s    r   c                s@  | j }|j d}|jr:|jd dkr:| jd }t| d}|dkrh| j dkrZdS jd   S t|dddkr|j	}|jd |j
 d   S tdrjd j }nxt|j	ddD ]>}|j d}|dkrq|kr|jd |j
 d   }P qW  fd	d
|j	g}|dkr<jd   }|S )z5Get a qualified name for the code running in `frame`.Nr   self.__func____qualname____mro__r   c                sd   x:| D ]2}|j  d }|kr|jd |j d   S qW x"| D ]}|j}|d k	rB|S qBW d S )Nr   )__dict__get
__module____name__	__bases__)basesbasefqname)fnamefuncmror   r   r    M   s    


z qualname_from_frame.<locals>.mro)r   r   co_argcountco_varnamesf_localsgetattr	f_globalsr   r   	__class__r   hasattrr   r   )r   comethodr   clsr   r   r   )r   r   r    r   r   -   s:    



r   N)__doc__r	   r   r   r   r   r   r   <module>   s   