
    |h                     V    S r SSKrSSKrSSKr " S S\R                  5      rS rS rg)zR
This module provides helper functions to find the first line of a function
body.
    Nc                   T   ^  \ rS rSrSrS rU 4S jrS\R                  4S jr	Sr
U =r$ )FindDefFirstLine   z
Attributes
----------
first_stmt_line : int or None
    This stores the first statement line number if the definition is found.
    Or, ``None`` if the definition is not found.
c                 *    Xl         X l        SU l        g)z>
Parameters
----------
code :
    The function's code object.
N)_co_name_co_firstlinenofirst_stmt_line)selfnamefirstlinenos      T/home/james-whalen/.local/lib/python3.13/site-packages/numba/misc/firstlinefinder.py__init__FindDefFirstLine.__init__   s     *#    c                 ^   > [         R                  " U5       H  n[        TU ]  U5        M     g )N)astiter_child_nodessupervisit)r
   nodechild	__class__s      r   _visit_children FindDefFirstLine._visit_children   s$    ))$/EGM%  0r   r   c                    UR                   U R                  :X  a  [        UR                  /5      nUR                  (       a*  UR                  S   nUR                  UR                  5        U R                  U;   aR  UR                  (       a@  UR                  S   n[        U5      (       a  UR                  S   nUR                  U l	        g  U R                  U5        g )Nr      )r   r   setlinenodecorator_listaddr   body_is_docstringr	   r   )r
   r   possible_start_linesfirst_decor
first_stmts        r   visit_FunctionDef"FindDefFirstLine.visit_FunctionDef#   s    99% $'}#5 "" #11!4$((););<##';; 99!%1J$Z00%)YYq\
+5+<+<D(
 T"r   )r   r   r	   )__name__
__module____qualname____firstlineno____doc__r   r   r   FunctionDefr&   __static_attributes____classcell__)r   s   @r   r   r      s'    	$!#coo # #r   r   c                     [        U [        R                  5      (       aS  [        U R                  [        R                  5      (       a*  [        U R                  R                  [
        5      (       a  gg)NTF)
isinstancer   ExprvalueConstantstr)r   s    r   r"   r"   A   sE    $!!tzz3<<00tzz//55r   c                 T   U R                   n [        UR                  5       nUR                  5       nSnSSS5        [        R                  " [        R                  " W5      5      n[        UR                  UR                   W-
  5      nUR#                  U5        UR$                  (       a  UR$                  U-   $ g! , (       d  f       N= f! [        [
        4 aI     [        R                  " U 5      u  pTSR                  U5      nUS-
  n N! [
        [        4 a      gf = ff = f)z
Look up the first line of function body using the file in
``pyfunc.__code__.co_filename``.

Returns
-------
lineno : int; or None
    The first line number of the function body; or ``None`` if the first
    line cannot be determined.
r   N r   )__code__openco_filenamereadFileNotFoundErrorOSErrorinspectgetsourcelinesjoin	TypeErrorr   parsetextwrapdedentr   co_nameco_firstlinenor   r	   )pyfunccofinsourceoffsetlinestreefinders           r   get_func_body_first_linenorO   I   s     
B
"..!SXXZFF " 99X__V,-Dbjj"*;*;f*DEF
LL%%.. % "! w' 	#226:MEWWU^FaZF# 		sE   C B=C =
CC C D'.DD#D'"D##D')r,   r   r>   rC   NodeVisitorr   r"   rO    r   r   <module>rR      s0   
   3#s 3#lr   