a
    ӗad	                     @   sd   d dl Z d dlZd dlZd dlZd dlZddlmZ dd Zdd Zdd	 Z	dddZ
dddZdS )    N   )	constantsc                 C   sV   t | } t | r&| j}|j|jfS t| tjr<t	| j
S t| tjrRt	| j
S d S N)inspectunwrap
isfunction__code__co_filenameco_firstlineno
isinstance	functoolspartial_get_function_sourcefuncpartialmethod)r   code r   9/home/manager/Python-3.9.10/Lib/asyncio/format_helpers.pyr   
   s    



r   c                 C   s8   t | |d }t| }|r4|d|d  d|d  7 }|S )Nz at r   :r   )_format_callbackr   )r   args	func_reprsourcer   r   r   _format_callback_source   s
    r   c                 C   sH   g }| r| dd | D  |r8| dd | D  dd|S )zFormat function arguments and keyword arguments.

    Special case for a single parameter: ('hello',) is formatted as ('hello').
    c                 s   s   | ]}t |V  qd S r   reprlibrepr).0argr   r   r   	<genexpr>&       z*_format_args_and_kwargs.<locals>.<genexpr>c                 s   s&   | ]\}}| d t | V  qdS )=Nr   )r   kvr   r   r   r   (   r    z({})z, )extenditemsformatjoin)r   kwargsr%   r   r   r   _format_args_and_kwargs   s    r)    c                 C   s   t | tjr.t||| }t| j| j| j|S t| drF| j	rF| j	}n t| dr^| j
r^| j
}nt| }|t||7 }|r||7 }|S )N__qualname____name__)r   r   r   r)   r   r   r   keywordshasattrr+   r,   r   )r   r   r(   suffixr   r   r   r   r   ,   s    r   c                 C   sD   | du rt  j} |du r tj}tjjt| |dd}|	  |S )zlReplacement for traceback.extract_stack() that only does the
    necessary work for asyncio debug mode.
    NF)limitlookup_lines)
sys	_getframef_backr   DEBUG_STACK_DEPTH	tracebackStackSummaryextract
walk_stackreverse)fr0   stackr   r   r   extract_stack>   s    
r=   )r*   )NN)r   r   r   r2   r6   r*   r   r   r   r)   r   r=   r   r   r   r   <module>   s   
