
    xKgO                     F    d Z ddlZ G d dej                        Zd Zd Zy)zR
This module provides helper functions to find the first line of a function
body.
    Nc                   H     e Zd ZdZd Z fdZdej                  fdZ xZ	S )FindDefFirstLinez
    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                 V    |j                   | _        |j                  | _        d| _        y)zf
        Parameters
        ----------
        code :
            The function's code object.
        N)co_name_co_nameco_firstlineno_co_firstlinenofirst_stmt_line)selfcodes     ^/home/alanp/www/video.onchill/myenv/lib/python3.12/site-packages/numba/misc/firstlinefinder.py__init__zFindDefFirstLine.__init__   s%     #22#    c                 X    t        j                  |      D ]  }t        |   |        y )N)astiter_child_nodessupervisit)r   nodechild	__class__s      r   _visit_childrenz FindDefFirstLine._visit_children   s$    ))$/EGM%  0r   r   c                    |j                   | j                  k(  rt        |j                  g      }|j                  r*|j                  d   }|j                  |j                         | j                  |v rH|j                  r;|j                  d   }t        |      r|j                  d   }|j                  | _	        y 	 | j                  |       y )Nr      )namer   setlinenodecorator_listaddr	   body_is_docstringr
   r   )r   r   possible_start_linesfirst_decor
first_stmts        r   visit_FunctionDefz"FindDefFirstLine.visit_FunctionDef!   s    99% $'}#5 "" #11!4$((););<##';; 99!%1J$Z0%)YYq\
+5+<+<D(
 T"r   )
__name__
__module____qualname____doc__r   r   r   FunctionDefr%   __classcell__)r   s   @r   r   r   	   s"    	$!#coo #r   r   c                     t        | t        j                        rIt        | j                  t        j                        r%t        | j                  j                  t
              ryy)NTF)
isinstancer   ExprvalueConstantstr)r   s    r   r!   r!   ?   s<    $!tzz3<<0tzz//5r   c                 4   | j                   }	 t        |j                        5 }|j                         }ddd       t	        j
                        }t        |      }|j                  |       |j                  S # 1 sw Y   FxY w# t        t        f$ r Y yw xY w)a  
    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.
    N)__code__openco_filenamereadr   parser   r   r
   FileNotFoundErrorOSError)pyfunccofinfile_contenttreefinders         r   get_func_body_first_linenor@   G   s     
B	&"..!S88:L "
 yy&!"%T%%% "!w' s'   B A9B 9B>B BB)r)   r   NodeVisitorr   r!   r@    r   r   <module>rC      s*   
 3#s 3#l&r   