o 7]h@sddlmZddlmZmZmZmZmZmZddl m Z m Z m Z m Z ddlmZmZddlmZddlmZddlmZdd lmZdd lmZdd lmZmZd ed efddZd ed efddZ GdddeZ!dS))absolute_import)cleandocgetdocgetfileisclassismodule signature)AnyIterableOptionalTuple)RenderableTypeGroup)ReprHighlighter) JupyterMixin)Panel)Pretty)Table)TextTextTypedocreturncCs|d\}}}|S)z)Get the first paragraph from a docstring.z ) partition)r paragraph_r;/usr/lib/python3/dist-packages/pip/_vendor/rich/_inspect.py_first_paragraphsrcCst|}|S)zReformat docstring.)rstrip)rrrr _reformat_docs r c@seZdZdZdddddddddd dedeeded ed ed ed ed edededdfddZdede fddZ de fddZ de dedee fddZdeefddZdS)InspectaA renderable to inspect any Python Object. Args: obj (Any): An object to inspect. title (str, optional): Title to display over inspect result, or None use type. Defaults to None. help (bool, optional): Show full help text rather than just first paragraph. Defaults to False. methods (bool, optional): Enable inspection of callables. Defaults to False. docs (bool, optional): Also render doc strings. Defaults to True. private (bool, optional): Show private attributes (beginning with underscore). Defaults to False. dunder (bool, optional): Show attributes starting with double underscore. Defaults to False. sort (bool, optional): Sort attributes alphabetically. Defaults to True. all (bool, optional): Show all attributes. Defaults to False. value (bool, optional): Pretty print value of object. Defaults to True. NFT) titlehelpmethodsdocsprivatedundersortallvalueobjr"r#r$r%r&r'r(r)r*rc Csdt|_||_|p |||_| rd}}}||_||_|p ||_|p%||_||_ ||_ | |_ dS)NT) r highlighterr+ _make_titler"r#r$r%r&r'r(r*) selfr+r"r#r$r%r&r'r(r)r*rrr__init__+s    zInspect.__init__cCs:t|s t|s t|rt|ntt|}||}|S)zMake a default title.)rcallablerstrtyper,)r.r+ title_str title_textrrrr-Fs  zInspect._make_titlecCstjt||jdddS)Nz scope.borderrr )r" border_stylepadding)rfitr_renderr")r.rrr__rich__Ps  zInspect.__rich__namec Csz tt|d}Wntyd}Yn tyYdSwd}zt|}Wn ty0Ynwt|dd}|rA|d|||}|pMt|d|}t d|df|}|S) zGet a signature for a callable.:z(...)Nzinspect.callablestylez link file:// __qualname__)zdef z inspect.def) r1r ValueError TypeErrorrrstylizer,getattrassemble) r.r;r+ _signaturesource_filename callable_namesignature_textqualnamequal_signaturerrr_get_signatureXs,       zInspect._get_signaturec#sdtttfdtttffdd}dtdtttfffdd |jt}t|}|js6dd |D}|js@d d |D}|t|}fd d |D}|j rX|j |d t j d dd}|j dd|j }|j}tr|d} | dur| VdV|jrt} | dur|jst| } tt| dd} || } | VdV|jrtstststtddddddVdV|D]\} \} }t| | drdndfd}| dur|}|d |||t | qt|rI|j!sq|| |}|dur||t||d!q|jrCt|}|durCtt|} |js)t| } |"d"| vr2d"nd#|| }|d$|"||||q||t||d!q|j#r\|VdSt$d%|d&VdS)'zRender object.itemrcSs"|\}\}}t||dfS)Nr)r0rlower)rLkey_errorr*rrr sort_itemsvs z#Inspect._render..sort_items attr_namec s>zdt|fWSty}z |dfWYd}~Sd}~ww)zGet attribute or any exception.N)rC Exception)rQerror)r+rr safe_getattrzs z%Inspect._render..safe_getattrcSg|] }|ds|qS)__ startswith.0rNrrr z#Inspect._render..cSrU)rrWrYrrrr[r\csg|]}||fqSrrrY)rTrrr[s)rNr5F)r7expandright)justifyNz inspect.helpr=T <) indent_guides max_length max_stringzinspect.value.border)r6rVzinspect.attr.dunderz inspect.attr)z =zinspect.equalsz inspect.error)r,  z inspect.docz[b cyan]za[/][i] attribute(s) not shown.[/i] Run [b][magenta]inspect[/]([not b]inspect[/])[/b] for options.)%r r1r boolr+dirlenr'r&r(rgrid add_columnadd_rowr,r0rKr%rr#rrr r*rrrrrDrXcopyrBreprr$append row_count from_markup)r.rPkeys total_itemsnot_shown_countitems items_tablermr,r_docdoc_textrNrSr*key_textwarning_signature_textr%rr)r+rTrr9ss"                zInspect._render)__name__ __module__r?__doc__r r rrhr/rr-rr:r1rKr rr9rrrrr!sL      r!N)" __future__rinspectrrrrrrtypingr r r r consolerrr,rjupyterrpanelrprettyrtablertextrrr1rr r!rrrrs