
    ^hڛ                     "   % S r SS/rSSKJr  SSKJr  SSKJr  SSKrSSK	r	SSKrSSK
rSSKrSSKrSSKrSSKrSSKrSSKJrJrJrJrJrJr  \R0                  S	::  a  SS
KJr  OSS
KJr  SSKJr  SSKJr  SSKJ r   SSK!J"r"  SSK!J#r#  SSK$J%r%  SSK&J'r'  SSK(J)r)  SSK*J+r+  SSK*J,r,  SSK-J.r.J/r/J0r0  SSK1J2r2  SSK3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:  SSK;J<r<  Sr=\\>\\\>\>4      4   r?\\@S'   \\>\>4   rA\\@S'   \ " S S 5      5       rBS! rC\R                  R                  R                   rF\GR                  R                   rI\R                  \R                  \R                  \L4 V s1 s H  n \R                  U 5      iM     sn rN\O" \P5      rQ\O" \>R                  5      rS\.rT\"R                  rV/ S"QrWS# rXS$ rYS%\\>S4   4S& jrMS1S%\\>S4   4S' jjrZS( r[\6S) 5       r\\6S* 5       r]\6S2S+ j5       r^S, r_S%\>4S- jr`S. ra " S/ S\45      rbS%\>4S0 jrcgs  sn f )3zTools for inspecting Python objects.

Uses syntax highlighting for presenting the various information elements.

Similar in spirit to the inspect module, but all calls take a name argument to
reference the name under which an object is being read.
	InspectorInspectColors    )	dataclass)	signature)dedentN)AnyOptionalDictUnionListTuple)   
   )	TypeAlias)page)pretty)skip_doctest)
PyColorize)openpy)safe_hasattr)compress_user)indent)list_namespace)typestr2type)
TermColorsColorSchemeColorSchemeTable)cast_unicode)	Colorable)undoc)	highlight)PythonLexer)HtmlFormatter__custom_documentations__UnformattedBundleBundlec                   ^    \ rS rSr% \\S'   \\S'   \\S'   \\   \S'   \\S'   \\S'   S r	S	r
g
)OInfo?   ismagicisaliasfound	namespaceparentobjc                     [        X5      $ )zvGet a field from the object for backward compatibility with before 8.12

see https://github.com/h5py/h5py/issues/2253
)getattr)selffields     O/home/james-whalen/.local/lib/python3.13/site-packages/IPython/core/oinspect.pyget	OInfo.getH   s     t##     N)__name__
__module____qualname____firstlineno__bool__annotations__r	   strr   r5   __static_attributes__r8   r7   r4   r(   r(   ?   s*    MMK}K	H$r7   r(   c                 :    [        U [        5       [        SS95      $ )NT)	noclasses)r!   r"   r#   )codes    r4   pylightrD   Y   s    T;=-$*GHHr7   )	type_name
base_classstring_formr-   lengthfile
definition	docstringsourceinit_definitionclass_docstringinit_docstringcall_defcall_docstringr*   r+   isclassr,   namec                  ^    [          Vs0 s H  oS_M     nnUR                  U 5        U$ s  snf )z1Make an object info dict with all fields present.N)info_fieldsupdate)kwkinfodicts      r4   object_inforZ   |   s.     +,1$H,OOBO -s   *c                 D   [        U 5      nUc  gUR                  S5      (       a  g[        R                  R	                  U5      (       d  g[
        R                  " US5       n[        R                  " UR                  5      u  p4SSS5        U$ ! , (       d  f       W$ = f)zfGet encoding for python source file defining obj

Returns None if obj is not defined in a sourcefile.
Nz.soz.dllz.pydrb)
	find_fileendswithospathisfile	stdlib_ioopenr   detect_encodingreadline)r/   ofilebufferencodingliness        r4   get_encodingrk      s    
 cNE }	/	0	0WW^^E""
 ^^E4(F$44V__EOH ) )(s   ##B
Breturnc                      U R                  5       n[        U[        5      (       a  [        R                  " U5      $  [        R                   " U 5      nU$ ! [
         a     N$f = f)a)  Stable wrapper around inspect.getdoc.

This can't crash because of attribute problems.

It also attempts to call a getdoc() method on the given object.  This
allows objects which provide their docstrings via non-standard mechanisms
(like Pyro proxies) to still be inspected by ipython's ? system.
)getdoc
isinstancer?   inspectcleandoc	Exception)r/   dsdocstrs      r4   rn   rn      s^    (ZZ\ b###B'' ^^C FM  s   A 
A#"A#c           	         [        U [        5      (       a  / nS H  n[        X5      nUc  M  [        U5      nU(       a  SU-  OSnUR	                  SR                  SXc45      5        [        R                  " U5      (       a0  [        U5      nU(       a  UR	                  [        U5      5        M  M  UR	                  U< U< S[        U5      < S35        M     U(       a  SR                  U5      $ g[        U 5      n  [        R                  " U 5      nU$ ! [         a<     [        R                  " U R                  5      n U$ ! [        [        4 a      gf = f[         a     gf = f)a<  Wrapper around inspect.getsource.

This can be modified by other projects to provide customized source
extraction.

Parameters
----------
obj : object
    an object whose source code we will attempt to extract
oname : str
    (optional) a name under which the object is known

Returns
-------
src : unicode or None

)fgetfsetfdelNz%s. z# z = 
)ro   propertyr1   rk   appendjoinrp   
isfunction	getsourcer   r   _get_wrapped	TypeError	__class__OSError)	r/   onamesourcesattrnamefnri   oname_prefix_srcsrcs	            r4   r   r      sB   & #x  0H'B~'+27Rrwwl'EFG%%b))$R=Dvd|4  NN)5xL 1" 99W%%
 3
	##C(C 
  	''6 
 Y'  		s0   D 
E*$ EEE*EE*)E*c                     [         R                  " U 5      =(       dD    [         R                  " U 5      =(       d'    [        U [        5      =(       d    [        U [
        5      $ )zTrue if obj is a function ())rp   r~   ismethodro   _builtin_func_type_builtin_meth_typer/   s    r4   is_simple_callabler      sK    s# Ww'7'7'< Ws./W3=cCU3VXr7   c                     [         R                  " S[        SS9  [        U S5      (       a  [	        U 5      (       d  U R
                  n [        R                  " U 5      $ )zWrapper around :func:`inspect.getfullargspec`

In addition to functions and methods, this can also handle objects with a
``__call__`` attribute.

DEPRECATED: Deprecated since 7.10. Do not use, will be removed.
z]`getargspec` function is deprecated as of IPython 7.10and will be removed in future versions.   
stacklevel__call__)warningswarnDeprecationWarningr   r   r   rp   getfullargspecr   s    r4   
getargspecr      sP     MM <=O\]_ C$$-?-D-Dll!!#&&r7   c                     [         R                  " S[        SS9  [        R                  " U S   U S   U S   U S   5      $ )zFormat argspect, convenience wrapper around inspect's.

This takes a dict instead of ordered arguments and calls
inspect.format_argspec with the arguments in the necessary order.

DEPRECATED (since 7.10): Do not use; will be removed in future versions.
za`format_argspec` function is deprecated as of IPython 7.10and will be removed in future versions.r   r   argsvarargsvarkwdefaults)r   r   r   rp   formatargspec)argspecs    r4   format_argspecr     sO     MM <=O\]_   ')2D!(!17:3FH Hr7   c                 h   [         R                  " S[        SS9  U R                  S5      nUc  SnO/ US   S   S:H  nU(       a  US   S	S US'   U S
   [        U5      -   nU R                  S5      nUc  U R                  S5      nUc  U R                  SS5      nX54$ ! [        [
        4 a     N`f = f)z?DEPRECATED since 6.0. Extract call tip data from an oinfo dict.zZ`call_tip` function is deprecated as of IPython 6.0and will be removed in future versions.r   r   r   Nr   r   r2      rS   rQ   rO   rK   ry   )r   r   r   r5   KeyError
IndexErrorr   )oinfoformat_callr   	call_linehas_selfdocs         r4   call_tipr     s     MM	2	 ii	"G	
	6vq)V3H ")&/!""5&M."99	 ))$
%C
{ii()
{iiB'>! *% 		s   B B10B1c                     U nSn[        U S5      (       a,  U R                  n US-  nUS:  a  U$ [        U S5      (       a  M,  U $ )a:  Get the original object if wrapped in one or more @decorators

Some objects automatically construct similar objects on any unrecognised
attribute access (e.g. unittest.mock.call). To protect against infinite loops,
this will arbitrarily cut off after 100 levels of obj.__wrapped__
attribute access. --TK, Jan 2016
r   __wrapped__r   d   )r   r   )r/   orig_objis      r4   r   r   <  sO     H	A
sM
*
*oo	Qs7O sM
*
* Jr7   c                    [        U 5      n Sn [        R                  " U 5      n[        U5      $ ! [         a;     [        R                  " U R                  5      n N8! [
        [        4 a      NKf = f[
         a     NZf = f)a6  Find the absolute path to the file where an object was defined.

This is essentially a robust wrapper around `inspect.getabsfile`.

Returns None if no file can be found.

Parameters
----------
obj : any Python object

Returns
-------
fname : str
    The absolute path to the file where the object was defined.
N)r   rp   
getabsfiler   r   r   r   )r/   fnames     r4   r^   r^   N  s      s
CE""3'   	&&s}}5E# 		  s,   0 
B  AA1-B 0A11B ?B c                     [        U 5      n  [        R                  " U 5      S   nU$ ! [         a?     [        R                  " U R                  5      S   n U$ ! [
        [        4 a      gf = f[
         a     gf = f)a/  Find the line number in a file where an object was defined.

This is essentially a robust wrapper around `inspect.getsourcelines`.

Returns None if no file can be found.

Parameters
----------
obj : any Python object

Returns
-------
lineno : int
    The line number where the object definition starts.
r   N)r   rp   getsourcelinesr   r   r   )r/   linenos     r4   find_source_linesr   q  s      s
C	'',Q/ M  	++CMM:1=F M # 		 s,   ( 
A<#AA-)A<,A--A<;A<c            	         ^  \ rS rSr\\R                  SSSS4U 4S jjrS"S\\	S4   4S jjr
S\	4S jrS rS	 rS"S
 jr\S#S j5       rS"S jrS"S jrS$S\	S\4S jjrS\S\4S jrS\S\	S\	4S jrS\4S jr     S%S\S\	S\\   S\4S jjr      S&S\\   4S jjrS'S jrS'S\ \	\4   4S jjr!\"S 5       r#/ SS4SS.S  jjr$S!r%U =r&$ )(r   i  Nr   c                    > [         [        U ]  XVS9  Xl        [        R
                  " SXS9U l        U R                  R                  U l        X@l        U R                  U5        g )N)r.   configr?   )outr.   style)
superr   __init__color_tabler   Parserparserformatstr_detail_levelset_active_scheme)r2   r   code_color_tableschemer   r.   r   r   s          r4   r   Inspector.__init__  sV    
 	i'v'E& ''E$Mkk(( 0v&r7   rl   c                 ^    [        U5      (       d  g [        [        U5      U5      $ !    g= f)zReturn the call signature for any callable object.

If any exception is generated, None is returned instead and the
exception is suppressed.N)callable_render_signaturer   )r2   r/   r   s      r4   _getdefInspector._getdef  s0    
 }}	$Ys^U;;	s   ( ,c                     U R                   R                  R                  < U< U R                   R                  R                  < 3$ )z*Return a header string with proper colors.)r   active_colorsheadernormal)r2   hs     r4   __headInspector.__head  s:    ++99@@++99@@B 	Br7   c                     UbA  U R                   R                  U5        U R                  R                   R                  U5        g g N)r   r   r   )r2   r   s     r4   r   Inspector.set_active_scheme  s9    ..v6KK##55f= r7   c                 ^    [        SU-  SS9  U(       a  [        SU-  5        g[        5         g)z-Generic message when no information is found.zNo %s found endzfor %sN)print)r2   msgr   s      r4   noinfoInspector.noinfo  s&    mc!s+(U"#Gr7   c                    [        U5      (       d  [        S5        gSn[        R                  " U5      (       a  U R	                  S5      nU R                  X5      nUc  U R                  SU5        g[        X0R                  U5      SS9  g)zoPrint the call signature for any callable object.

If the object is a class, print the constructor information.zObject is not callable.Nry   zClass constructor information:
zdefinition headerr   r   )r   r   rp   rR   _Inspector__headr   r   r   )r2   r/   r   r   outputs        r4   pdefInspector.pdef  ss    
 }}+,??3[[!CDF c(>KK+E2&V,#6r7   c                 
   U R                   n/ n[        U5      nU(       a  U" U5      R                  SU5      nU(       a1  UR                  U" S5      5        UR                  [	        U5      5        [
        R                  " U5      (       a[  [        US5      (       aJ  [        UR                  5      nUb1  UR                  U" S5      5        UR                  [	        U5      5        O^[        US5      (       aM  [        UR                  5      nU(       a1  UR                  U" S5      5        UR                  [	        U5      5        U(       d  U R                  SU5        g[        R                  " S	R                  U5      5        g)
a  Print the docstring for any object.

Optional:
-formatter: a function to run the docstring through for specially
formatted docstrings.

Examples
--------
In [1]: class NoInit:
   ...:     pass

In [2]: class NoDoc:
   ...:     def __init__(self):
   ...:         pass

In [3]: %pdoc NoDoc
No documentation found for NoDoc

In [4]: %pdoc NoInit
No documentation found for NoInit

In [5]: obj = NoInit()

In [6]: %pdoc obj
No documentation found for obj

In [5]: obj2 = NoDoc()

In [6]: %pdoc obj2
No documentation found for obj2
z
plain/textzClass docstring:r   NzInit docstring:r   zCall docstring:documentationrz   )r   rn   r5   r|   r   rp   rR   hasattrr   r   r   r   r}   )	r2   r/   r   	formatterheadrj   rs   init_dscall_dss	            r4   pdocInspector.pdoc  s   D {{C[2""<4BLL012LL$??3GC$<$<S\\*G"T"345VG_-S$$S\\*GT"345VG_-KK.IIdii&'r7   c                     [         R                  " 5          [        XS9nUc  U R	                  SU5        g[
        R
                  " U R                  U5      5        g! [         a    Sn NJf = f)z$Print the source code for an object.)r   NrL   )	linecache
checkcacher   rr   r   r   r   )r2   r/   r   r   s       r4   psourceInspector.psource  s_     		C-C ;KK%(IIdkk#&'  	C	s   	A A+*A+c           	         [        U5      nUc  U R                  SU5        g[        U5      nUR                  S5      (       a  [	        SU-  5        g[
        R                  R                  U5      (       d  [	        SU-  5        g[        R                  " U R                  [        R                  " USS95      US-
  5        g)	z0Show the whole file where an object was defined.NrI   r\   z File %r is binary, not printing.z%File %r does not exist, not printing.F)skip_encoding_cookier   )r   r   r^   r_   r   r`   ra   rb   r   r   r   read_py_file)r2   r/   r   r   rg   s        r4   pfileInspector.pfile  s     #3'>KK&# >>1224u<=&&9EAB
 IIdkk&"5"5eRW"XY[ade[efr7   textc                     US[         R                  " U5       S3S.nUc  U$ U" U5      n[        U[        5      (       d	  USU S3S.$ [        U40 UD6$ )a
  Return a mime bundle representation of the input text.

- if `formatter` is None, the returned mime bundle has
   a ``text/plain`` field, with the input text.
   a ``text/html`` field with a ``<pre>`` tag containing the input text.

- if ``formatter`` is not None, it must be a callable transforming the
  input text into a mime bundle. Default values for ``text/plain`` and
  ``text/html`` representations are the ones described above.

Note:

Formatters returning strings are supported but this behavior is deprecated.

z<pre>z</pre>
text/plain	text/html)htmlescapero   dict)r2   r   r   r   	formatteds        r4   _mime_formatInspector._mime_format2  sp    "  T!2 36:

 O!$Ii.. '0i[PV>WXX H2	22r7   bundlec                    [        US   [        5      (       d   eUS    H  n[        U[        5      (       a  M   e   0 n/ n[        S US    5       5      nUS    HZ  u  pgUR	                  S5      nSU;   a  SOSnUR                  U R                  US-   5       U[        U5      -
  S-   U U 35        M\     SR                  U5      US'   SU;   ay  [        US   [        5      (       d   eUS    H  n[        U[        5      (       a  M   e   [        US   [        [        45      (       a  SR                  S US    5       5      US'   UR                  5        H  n	U	S;   a  M  X   nM     U$ )	zRFormat a mimebundle being created by _make_info_unformatted into a real mimebundler   c              3   <   #    U  H  u  p[        U5      v   M     g 7fr   len).0r   _s      r4   	<genexpr>(Inspector.format_mime.<locals>.<genexpr>]  s     ;&:da3q66&:s   rz   r   :r   c              3   6   #    U  H  u  pS U SU 3v   M     g7f)z<h1>z</h1>
Nr8   )r  r   bodys      r4   r
  r  p  s!     XDWLTtD6/DWs   )r   r   )
ro   listtuplemaxstripr|   r   r  r}   keys)
r2   r  itemnew_brj   _lenr   r  delimrX   s
             r4   format_mimeInspector.format_mimeT  s    &.5555<(DdE**** ) ;f\&:;; .JD::d#D DLDcELL;;tCx()4#d)+;S*@)A%O / #ii.l& f[148888{+!$.... , &-e}==%)YYXF;DWX&k" A//		 
 r7   titlekeyc                     X%;   d  X5;   a  gXC   nUbB  U R                  Xv5      nUS   R                  X(S   45        US   R                  X(S   45        gg)z^Append an info value to the unformatted mimebundle being constructed by _make_info_unformattedNr   r   )r  r|   )	r2   r  r  r  infoomit_sectionsr   r3   formatted_fields	            r4   _append_info_fieldInspector._append_info_fieldz  sj     !S%9	"//AO< ''0M(NO;&&{/K'LM r7   c                 8  ^ ^^ / / S.n S*S[         S[        S[        4UUU 4S jjjnS[        4U 4S jjnTS   (       a  U" US	S
5        U$ TS   (       a)  US:  a  U" USSU5        OU" USSU5        U" USS5        U$ TS   (       d  [        U5      (       ah  U" USSU5        U" USSU5        U" USSU5        US:  a  TS   (       a  U" USSU5        OU" USSU5        U" USS5        U" USS5        U" USS5        U$ U" USSU5        U" USSU5        U" USS5        U" US S
5        TS!   S":w  a
  U" US#S!5        U" US$S%5        U" USS5        US:  a  TS   (       a  U" USSU5        OU" USSU5        U" US&S'U5        U" USSU5        U" US(S)U5        U$ )+z;Assemble the mimebundle as unformatted lists of informationr   r  r  r  c           	      .   > TR                  U UUTTUS9  g )N)r  r  r  r  r   )r   )r  r  r  r   r  r  r2   s       r4   append_field6Inspector._make_info_unformatted.<locals>.append_field  s*     ##+# $ r7   rl   c                 >   > TR                  U 5      [        U 5      S.$ )Nr   )r   rD   )r   r2   s    r4   code_formatter8Inspector._make_info_unformatted.<locals>.code_formatter  s     "kk$/$T] r7   r+   ReprrG   r*   r   SourcerL   	DocstringrK   FilerI   rR   	SignaturerJ   zInit signaturerM   zInit docstringrO   TyperE   
Subclasses
subclasseszCall signaturerP   zString formr-   Interactive	NamespaceLengthrH   zClass docstringrN   zCall docstringrQ   r   )r%   r?   r&   r   )	r2   r/   r  r   detail_levelr  r  r$  r'  s	   ` `  `   r4   _make_info_unformatted Inspector._make_info_unformatted  s	   
 %
 HL
	%
	.1
	8;
	 
		F 	 	?7^ [ )_aVXxHV[+yI0P M )_ 23 7 7lNK!13DnUk9EaDNVXxHV%57GS05|<4 - lNK!1:~N5> K M1V[+>840 aDNVXxHV[+yI!24EyQ!13CYO!13CYOr7   r/   r   r  c                 j    U R                  XXES9nU R                  UUUUUS9nU R                  U5      $ )a  Retrieve an info dict and format it.

Parameters
----------
obj : any
    Object to inspect and return info from
oname : str (default: ''):
    Name of the variable pointing to `obj`.
formatter : callable
info
    already computed information
detail_level : integer
    Granularity of detail level, if set to 1, give more information.
omit_sections : container[str]
    Titles or keys to omit from output (can be set, tuple, etc., anything supporting `in`)
r   r  r4  )r4  r  )r  r5  r  )	r2   r/   r   r   r  r4  r  	info_dictr  s	            r4   	_get_infoInspector._get_info  sM    4 IIcTIU	,,%' - 
 ''r7   c           	      p    Uc   eU R                  XX4XWS9nU(       d  US	 [        R                  " U5        g)a  Show detailed information about an object.

Optional arguments:

- oname: name of the variable pointing to the object.

- formatter: callable (optional)
      A special formatter for docstrings.

      The formatter is a callable that takes a string as an input
      and returns either a formatted string or a mime type bundle
      in the form of a dictionary.

      Although the support of custom formatter returning a string
      instead of a mime type bundle is deprecated.

- info: a structure with some information fields which may have been
  precomputed already.

- detail_level: if set to 1, more information is given.

- omit_sections: set of section keys and titles to omit
N)r  r   )r:  r   )	r2   r/   r   r   r  r4  enable_html_pagerr  info_bs	            r4   pinfoInspector.pinfo  sD    B 	 ( 
 !{#		&r7   c                 V    [         R                  " S[        SS9  U R                  XX4S9$ )zz
Inspector.info() was likely improperly marked as deprecated
while only a parameter was deprecated. We "un-deprecate" it.
zThe `Inspector.info()` method has been un-deprecated as of 8.0 and the `formatter=` keyword removed. `Inspector._info` is now an alias, and you can just call `.info()` directly.r   r   r8  )r   r   r   r  )r2   r/   r   r  r4  s        r4   _infoInspector._info(  s3     	B 	
 yyyPPr7   c                    Uc  SnSnSnO$UR                   nUR                  nUR                  nUR                  S5      S   nSn	Sn
U(       aX  UR                  bK  [        UR                  [        5      (       a,  [        UR                  [        5      nUR                  US5      n	[        USXeSS9nU	(       a  U	nOfU(       aL  [        U5      (       d
   SUS	   -  nOES[        U5      -   nUR                  (       a  USUR                  -   -  nO[        U5      nUc  SnOUnX-   nSn[        US-
  S-  5      nU(       a  SUS'   O%U(       a  SUS'   O[        U5      R                   US'    UR"                  n[        U5      US'   X@R$                  :  a|   [        U5      nSnU(       db  ['        U5      U:  aS  USU S-   UU* S -   nSS['        UR)                  5       5      -  -   R+                  S UR                  S5       5       5      nUUU'   U(       a  X|S'    [        ['        U5      5      US'   Sn[/        U5      nUc  SnO?UR1                  S5      (       a  SnOUR1                  S5      (       a  Sn[3        U5      US'   U(       aU  [4        R6                  " 5          [9        U[:        5      (       d  U(       d#  [=        X5      nUb  UR?                  5       nUUS '   U(       a*  U RA                  UR                  S 5      U5      (       d  XS!'   [B        RD                  " U5      (       a  SUS"'    U RG                  X5      n URJ                  nUc   U RG                  UU5      n[        U5      nU[L        :X  a  SnU(       a  UUS#'   U(       a  UUS$'   [        RO                  U5       Vs/ s H  nUR                   PM     nn['        U5      S%:  a  S&R+                  U5      nOS&R+                  USS% S'/-   5      nUUS('   GOU RG                  X5      nU(       a  UUS)'   U(       a6   [        US*5      n[        U5      nU[P        ;   a  SnU(       a  UU:w  a  UUS+'    [        URJ                  5      nU[L        :X  a  SnU(       a  UUS$'   [S        US,5      (       az  [U        U5      (       dj  U RG                  URV                  U5      n U (       a  U UR                  S)5      :w  a  U US-'   [        URV                  5      n!U![X        :X  a  Sn!U!(       a  U!US.'   [[        S/0 UD6$ !   S
[        U5      -   n GN= f!    GN= f!    GN6= f! [,         a     GN#f = f! [,         a     GNf = f! [H         a    Sn GN6f = f! [H         a     GN$f = f! [H         a    Sn GN f = fs  snf !   Sn GNm= f! [H         a    Sn GN?f = f)0a  Compute a dict with detailed information about an object.

Parameters
----------
obj : any
    An object to find information about
oname : str (default: '')
    Name of the variable pointing to `obj`.
info : (default: None)
    A struct (dict like with attr access) with some information fields
    which may have been precomputed already.
detail_level : int (default:0)
    If set to 1, more information is given.

Returns
-------
An object info dict with known fields from `info_fields`. Keys are
strings, values are string or None.
NFry   .T)rS   r,   r+   r*   r0  z!Alias to the system command:
  %sr   zAlias: z	Alias to z
Docstring:
z<no docstring>      r   zMagic functionrE   zSystem aliasrF   rG   z <...> rz   r   c              3   @   #    U  H  oR                  5       v   M     g 7fr   )r  )r  qs     r4   r
  !Inspector.info.<locals>.<genexpr>  s      E4Dq4Ds   r-   rH   r\   z<string>z9Dynamically generated function. No source code available.rI   rL   rK   rR   rM   rO   r   , z...r0  rJ   r   rN   r   rP   rQ   r8   ).r*   r+   r-   splitr.   r   	HOOK_NAMEr1   r5   r   r   r?   __doc__rn   inttyper9   r   r   r  
expandtabsr}   rr   r^   r_   r   r   r   ro   r{   r   rstrip_source_contains_docstringrp   rR   r   AttributeErrorr   _object_init_docstring__subclasses___builtin_type_docstringsr   r   r   _func_call_docstringrZ   )"r2   r/   r   r  r4  r*   r+   ospaceatt_nameparents_docspreludeparents_docs_dictr   rs   
ds_or_None
string_maxshalfbclassostrstr_headbinary_filer   r   init_defobj_initr   subnames	all_namesdeflnclsclass_dsrP   r   s"                                     r4   r  Inspector.info7  s   * <GGFllGllG^^F ;;s#B'DKK+Y0O0O 'Y ?,004@LdGQU
 BC==.=AFB !3s8+;;*S[[88BJ!%\ 
Z!^q()/C-C#Cy11C	]]F #FC
 000	3x(#D	*(<<)3dE67mCD 3X-@-@-B)C#CC D EDJJt4D EE  $H %	CMCM
 #= K~~566"
++S'.CK    "c8,,K#C/C!jjl$'CM d55cggh6GLL! ??3!C	N <<3
#<< ##'<<%#@ !*44"G)1%&(/$%-1-@-@-EF-EcS\\-EEF5zB IIe,	 IIeCRj%&89	 )C LL,E$)L! +!#k2C  &c{H77#Hh-5C)* .44"G (/$% C,,5G5L5L<<e<SWW\-B!B '/C
O .22"G,3C()!S!!c."SX-B:	  		:   "    *  " * G($#H " s   T$ ,T: A;U U
 #?U 4U, V U? .V#+V( !!V2 $T7:T?U

UU
U)(U),U<;U<?
VVV V (V/2WWc                      [         R                  " [        U 5      5      R                  u  n[         R                  " U5      U:H  $ ! [
         a     gf = f)z
Check whether the source *src* contains the docstring *doc*.

This is is helper function to skip displaying the docstring if the
source already contains it, avoiding repetition of information.
F)astparser   r  get_docstringrr   )r   r   def_nodes      r4   rT  $Inspector._source_contains_docstring  sK    	))F3K055KX$$X.#55 	 		s   AA 
AAF)
list_typesc          	         SnSnU(       a3  [         R                   " SR                  [        [        5      5      5        gUR	                  5       n	[        U	5      n
U
S:X  a  U	S   nOU
S:X  a  U	u  pO[        SU-  5      eU H)  nX;  d  M
  [        S	U< S
UR                  5       < 35      e   [        5       [        5       pU HN  nX.   n[        U5      U;   a  M  UR                  [        U5      5        [        XUXES9nUR                  U5        MP     [         R                   " SR                  [        U5      5      5        g)aB  Search namespaces with wildcards for objects.

Arguments:

- pattern: string containing shell-like wildcards to use in namespace
  searches and optionally a type specification to narrow the search to
  objects of that type.

- ns_table: dict of name->namespaces for search.

Optional arguments:

  - ns_search: list of namespace names to include in search.

  - ignore_case(False): make the search case-insensitive.

  - show_all(False): show all names, including those starting with
    underscores.

  - list_types(False): list all available object types for object matching.
allry   rz   Nr   r   r   z)invalid argument string for psearch: <%s>zinvalid namespace <z>. Valid names: )ignore_caseshow_all)r   r}   sortedr   rM  r  
ValueErrorr  setidaddr   rV   )r2   patternns_table	ns_searchrx  ry  ru  type_patternfiltercmdslen_cmdsrS   search_resultnamespaces_seenns_namenstmp_ress                    r4   psearchInspector.psearch*  s(   4  IIdii| 456}}Yq=!WF]"&F<H$% & & D# "&x}}"8 9 9  *- G"B"v(2'$Rv0;PG  ) ! 			$))F=123r7   )r   r   r   r   ry   )ry   Nr   )ry   NNr   r8   )ry   NNr   Tr8   )ry   Nr   )'r9   r:   r;   r<   r   r   ANSICodeColorsr   r   r?   r   r   r   r   r   r   r   r   r   r   r  r%   r&   r  r   r5  r   r	   r(   r:  r?  rB  r
   r  staticmethodrT  r  r@   __classcell__)r   s   @r4   r   r     s   #0",";";"#T	
'
eCHo 
B# B
>
7, 7( 7(r(g. 3  3  3D$"3 $ $LN!N N 	N$L	Ld  $"("( "(
 uo"( 
"(N  $'
 uo'RQ`"S#X `"D    13!5@4@E@4 @4r7   c                    / nSnSnU R                   R                  5        H  nUR                  [        R                  R
                  :X  a  SnOU(       a  UR                  S5        SnUR                  [        R                  R                  :X  a  SnOBUR                  [        R                  R                  :X  a  U(       a  UR                  S5        SnUR                  [        U5      5        M     U(       a  UR                  S5        [        U5      [        S U 5       5      -   S:  a)  SR                  USR                  S	 U 5       5      5      nO!S
R                  USR                  U5      5      nU R                  [        R                  La4  [        R                   " U R                  5      nUSR                  U5      -  nU$ )z
This was mostly taken from inspect.Signature.__str__.
Look there for the comments.
The only change is to add linebreaks when this gets too long.
FT/*c              3   >   #    U  H  n[        U5      S -   v   M     g7f)r   Nr  r  rs     r4   r
  $_render_signature.<locals>.<genexpr>  s     6v!3q6A:vs   K   z{}(
{})ry   c              3   D   #    U  H  nS R                  U5      v   M     g7f)z    {},
N)r   r  s     r4   r
  r    s!      73+1aKq!!6s    z{}({})rL  z -> {})
parametersvalueskindrp   	ParameterPOSITIONAL_ONLYr|   VAR_POSITIONALKEYWORD_ONLYr?   r  sumr   r}   return_annotation_emptyformatannotation)obj_signatureobj_nameresultpos_onlykw_onlyparamrenderedannos           r4   r   r   m  si    FHG))002::**:::HMM#H::**999GZZ7,,999gMM#Gc%j! 3 c 8}s6v666;$$Xrww 73+173 03 
 ??8TYYv->?&&gnn<''(G(GHHOOD))Or7   r  )T)drO  __all__dataclassesr   rp   r   textwrapr   rp  r   iorc   r   r`   systypesr   typingr   r	   r
   r   r   r   version_infotyping_extensionsr   IPython.corer   IPython.lib.prettyr   IPython.testing.skipdoctestr   IPython.utilsr   r   IPython.utils.dir2r   IPython.utils.pathr   IPython.utils.textr   IPython.utils.wildcardr   r   IPython.utils.coloransir   r   r   IPython.utils.py3compatr   IPython.utils.colorabler   IPython.utils.decoratorsr    pygmentsr!   pygments.lexersr"   pygments.formattersr#   rN  r?   r%   r>   r&   r(   rD   FunctionTyper   rY  objectr   rV  
ModuleType
MethodTyper{   rn   rX  rQ  rw  r   upperr   Colorsr  r   rU   rZ   rk   r   r   r   r   r   r   r^   r   r   r   )ts   0r4   <module>r     s;   
' "   
     	 
   : :w+   % 4 $   + , % 1 / M M 0 - *  ' -'	  $CeCHo)>$>? 9 ?cN	 " $ $ $2I ))22:: 00  % 0 0%2B2B % 2 2H > >!GNN1  > 
 #Y #))_  
)).5T? *<c$h <~X
 ' '" H H  " "J$ c  F>Z4	 Z4z(# (] s   %H