a `d @sdddlZddlZddlZddlZddlZddlmZddZddZdd Z dd d Z dd dZ dS)N) constantscCsVt|}t|r&|j}|j|jfSt|tjr&z*_format_args_and_kwargs..css&|]\}}|dt|VqdS)=Nr)rkvrrrr(r z({})z, )extenditemsformatjoin)rkwargsr%rrr_format_args_and_kwargss r)cCst|tjr.t|||}t|j|j|j|St|drF|j rF|j }n t|dr^|j r^|j }nt |}|t||7}|r||7}|S)N __qualname____name__) r r r r)rrrkeywordshasattrr+r,r)rrr(suffixrrrrr,s rcCsD|durtj}|dur tj}tjjt||dd}| |S)zlReplacement for traceback.extract_stack() that only does the necessary work for asyncio debug mode. NF)limit lookup_lines) sys _getframef_backrDEBUG_STACK_DEPTH traceback StackSummaryextract walk_stackreverse)fr0stackrrr extract_stack>s r=)r*)NN) r rrr2r6r*rrrr)rr=rrrrs