
    79j0&                     z    d dl Z d dlZd dlZd dlmZ i Z ej                  dej                        Zd Z	d Z
ddZy)    N)ufuncz[a-z0-9_]+\(.*[,=].*\)c           	          dd l }	 |j                  |       }|S # t        $ r; t        |       D cg c]  }t	        | |      s|t        | |      f nc c}w }}Y |S w xY w)Nr   )inspect
getmembers	Exceptiondirhasattrgetattr)itemr   membersxs       _/media/conek/DATA/Code/OCR/venv/lib/python3.12/site-packages/skimage/_vendored/numpy_lookfor.py_getmembersr      si    Q$$T* N  Q25d)PQwtQ?OAwtQ'(PPPNQs     AAAAAc                 t   ddl }ddlm} | d} t        | t              r 	 t        |        t        j                  |    } nGt        | t              st        | t              r'i }| D ]  }|j                  t        |||               |S t        |       t        v r|st        t        |          S i }|t        t        |       <   i }d}| j                  | fg}	|	r|	j!                  d      \  }
}t        |      |v r%d|t        |      <   |dz  }d}|j#                  |      r,d}	 |j$                  }|rt)        |d	      rv|j*                  D ]f  }t,        j.                  j1                  |      st,        j.                  j3                  |      sCt-        j4                  |      D ]  }t,        j.                  j7                  ||      }t,        j.                  j7                  ||d
      }t,        j.                  j1                  |      r|j9                  d      r|dd }n#t,        j.                  j1                  |      r|}n|dk(  r	 t        j:                  }t        j<                  }	  |       t        _         |       t        _        t        |
 d|        |t        _        |t        _         i tC        |      D ]  \  }}	 tE        |d|
 d|       }tE        |dd      }d|vr	|r| d| }|jI                  |
dz         st        |tJ              rnY|j#                  |      s|||v sq|	jM                  |
 d| |f        nM|jO                  |      r.d}tC        |      D ]  \  }}|	jM                  |
 d| |f        nt)        |d      rd}	 |jQ                  |      }||||f||
<   |	r|S # t        $ r i cY S w xY w# t&        $ r d}Y w xY w# |t        _        |t        _        w xY w# t>        $ r  t@        $ r Y kw xY w# tF        $ r |
 d| }d}Y Aw xY w# tF        $ r d}Y w xY w)a  
    Generate docstring cache for given module.

    Parameters
    ----------
    module : str, None, module
        Module for which to generate docstring cache
    import_modules : bool
        Whether to import sub-modules in packages.
    regenerate : bool
        Re-generate the docstring cache

    Returns
    -------
    cache : dict {obj_full_name: (docstring, kind, index), ...}
        Docstring cache for the module, either cached one (regenerate=False)
        or newly generated.

    r   N)StringIOskimageT   objectmodule__path__z__init__.pyz.py__init__.__name__
__module__class__call__func))r   ior   
isinstancestr
__import__ImportErrorsysmoduleslisttupleupdate_lookfor_generate_cacheid_lookfor_cachesr   popismodule__all__AttributeErrorr	   r   ospathisfileexistslistdirjoinendswithstdoutstderrKeyboardInterruptBaseExceptionr   r
   	NameError
startswithr   appendisclassgetdoc)r   import_modules
regenerater   r   cachemodseenindexstacknamer   kind_allpthmod_paththis_pyinit_py	to_import
old_stdout
old_stderrnv	item_namemod_namedocs                             r   r)   r)   "   s-   * ~&#	v V$	FD	!Z%> 	SCLL0njQR	S	&z_$Zr&z** E"'OBvJDEoov&'E
YYq\
dd8tRX
D!D||
 '$
";== %Cww~~c*"''..2E $&JJsO %"$'',,sH"="$'',,sHm"L77>>'2x7H7H7O(0"IWW^^G4(0I$$
2$%),J),J8-5Z
-5Z
 *dV1YK+@ A-7
-7
+%%B $D) 11$ '"&!!I
  'q,=H i'H#+*Ai[ 9I ++D3J7!!U+ !**1-dasmQ/0516 __T"D#D) 11asmQ/01T:&D	..&C ?e,E$Kw z L_  	I	> " 8 .8
-7
0 "!, % %% ! $ $(&!I#H	$8  	C	sq   N9 !O
  O7'0OO7PP) 9OO
OOO44O77PPP&%P&)P76P7c                 h   ddl }t        |||      g }t        |       j                         j	                         syj                         D ]D  \  }\  }}	}
|	dv r|j                         t        fdD              s4|j                  |       F dddddfdfd	}|j                  |
       ddj                         d}|dt        |      z  g}|ddd   D ]  }|   \  }	}j                         j	                  d      D cg c]#  }|j                         s|j                         % }}	 |d   j                         }t        j                  |      r|d   j                         }|j                  | d|         |s|j                  d       |!|j                  dj                  |             yt        |      dkD  r(|j!                         } |dj                  |             yt#        dj                  |             yc c}w # t        $ r d}Y w xY w)a  
    Do a keyword search on docstrings.

    A list of objects that matched the search is displayed,
    sorted by relevance. All given keywords need to be found in the
    docstring for it to be returned as a result, but the order does
    not matter.

    Parameters
    ----------
    what : str
        String containing words to look for.
    module : str or list, optional
        Name of module(s) whose docstrings to go through.
    import_modules : bool, optional
        Whether to import sub-modules in packages. Default is True.
    regenerate : bool, optional
        Whether to re-generate the docstring cache. Default is False.
    output : file-like, optional
        File-like object to write the output to. If omitted, use a pager.

    See Also
    --------
    source, info

    Notes
    -----
    Relevance is determined only roughly, by checking if the keywords occur
    in the function name, at the start of a docstring, etc.

    Examples
    --------
    >>> np.lookfor('binary representation') # doctest: +SKIP
    Search results for 'binary representation'
    ------------------------------------------
    numpy.binary_repr
        Return the binary representation of the input number as a string.
    numpy.core.setup_common.long_double_representation
        Given a binary dump as given by GNU od -b, look for long double
    numpy.base_repr
        Return a string representation of a number in the given base system.
    ...

    r   N)r   r   c              3   &   K   | ]  }|v  
 y wN ).0wrU   s     r   	<genexpr>zlookfor.<locals>.<genexpr>   s     'AqCx's   i  )r   r   r   r   c                    d}dj                  |j                         j                         j                  d      d d       }|t	        D cg c]	  }||v sd c}      z  }|t	        D cg c]	  }|| v sd c}      z  }|t        |        dz  z  }|j                  |d      z  }|| j                  d       d	z  z  }|t        | d
z  d      z  }|S c c}w c c}w )Nr   
            r]   r   
   d   i)	r5   lowerstripsplitsumlengetcountmax)	rG   docstrrH   rE   r	first_docr[   kind_relevancewhatss	          r   	relevancezlookfor.<locals>.relevance   s    IIflln224::4@!DE		Su7!Y#788	Se1qDy"122	c$iZ!^	^e,,	djjo""	S%#t$$ 81s   	C
C
.	C
8C
c                      | g|     S rX   rY   )arB   rs   s    r   relevance_valuez lookfor.<locals>.relevance_value
  s    &U1X&&    )keyzSearch results for ' '-r_   r    z
    zNothing found.rd   )pydocr)   r!   rf   rh   itemsallr=   sortr5   rj   rg   _function_signature_research
IndexErrorwritegetpagerprint)whatr   r@   rA   outputr~   foundrG   	docstringrH   rE   rv   s	help_textixlinedoclinesrp   pagerrB   rU   rq   rs   rr   s                      @@@@@r   lookforr      s   Z  $FNJGE EIOO##%E*/++- &&y$''oo'''LL #TUeTN ' 
JJ?J# sxx/q1AC#a&L!Idd 5dT2-0YY[->->t-DUT

DJJLUU	 ))+I%,,Y7$QK--/	 	D6	{345 )* TYYy)*	Y"	 dii	"#dii	"#+ V  	I	s   H/H;H##H10H1)NTFN)r$   r0   renumpyr   r+   compileIr   r   r)   r   rY   rw   r   <module>r      sF     	 	  
 $$=rttD Nbw$rw   