
    J/PhO                     D    d Z ddlZ G d dej                  Zd Zd ZdS )zR
This module provides helper functions to find the first line of a function
body.
    Nc                   >     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                 D    |j         | _        |j        | _        d| _        dS )zf
        Parameters
        ----------
        code :
            The function's code object.
        N)co_name_co_nameco_firstlineno_co_firstlinenofirst_stmt_line)selfcodes     Z/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/numba/misc/firstlinefinder.py__init__zFindDefFirstLine.__init__   s&     #2#    c                 x    t          j        |          D ]#}t                                          |           $d S )N)astiter_child_nodessupervisit)r   nodechild	__class__s      r   _visit_childrenz FindDefFirstLine._visit_children   s@    )$// 	! 	!EGGMM%    	! 	!r   r   c                 f   |j         | j        k    rt          |j        g          }|j        r'|j        d         }|                    |j                   | j        |v r?|j        r7|j        d         }t          |          r|j        d         }|j        | _	        d S 	 | 
                    |           d S )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    9%% $'}#5#5 " = #1!4$(();<<<#';;; 9 !%1J$Z00 2%)Yq\
+5+<D(F
 T"""""r   )
__name__
__module____qualname____doc__r   r   r   FunctionDefr%   __classcell__)r   s   @r   r   r   	   sn         	$ 	$ 	$! ! ! ! !#co # # # # # # # #r   r   c                     t          | t          j                  r@t          | j        t          j                  r!t          | j        j        t
                    rdS dS )NTF)
isinstancer   ExprvalueConstantstr)r   s    r   r!   r!   ?   sM    $!! tz3<00 	tz/55	45r   c                 @   | j         }	 t          |j                  5 }|                                }ddd           n# 1 swxY w Y   t	          j        |          }t          |          }|                    |           |j        S # t          t          f$ r Y dS 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	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&
 y&&!"%%T%% w'   s1   B >B AB AB BB)r)   r   NodeVisitorr   r!   r@    r   r   <module>rC      so    
 


3# 3# 3# 3# 3#s 3# 3# 3#l  & & & & &r   