o
�J�h�6 � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z
ddlmZ dZ
e�de
�Zd d
� Zdd� Zddd�Zdd� Zdd� Zde� fdd�Zdd� Zdd� Zddd�ZdS ) z>
My own variation on function-specific inspect-like features.
� N)�islice)�open� )�pformatzAargs varargs varkw defaults kwonlyargs kwonlydefaults annotations�FullArgSpecc C s d}zb| j }|j}tj�|�s8d�t�| �d �}d}|�d�r2t �
d|��� \}}t|�}d| }|||fW S t
|��}|j}tt||d d��}W d � n1 sTw Y d�t�|��||fW S t| d�ryt| j �� �|d f Y S t| �|d f Y S )
a/ Attempts to retrieve a reliable function code hash.
The reason we don't use inspect.getsource is that it caches the
source, whereas we want this to be modified on the fly when the
function is modified.
Returns
-------
func_code: string
The function code
source_file: string
The path to the file in which the function is defined.
first_line: int
The first line of the code in the source file.
Notes
------
This function does a bit more magic than inspect, and is thus
more robust.
N� r r z <doctest z\<doctest (.*\.rst)\[(.*)\]\>z<doctest %s>�__code__�����)r �co_filename�os�path�exists�join�inspect�getsourcelines�
startswith�re�match�groups�int�open_py_source�co_firstlineno�listr �getblock�hasattr�str�__hash__�repr)�func�source_file�code�source_code�line_noZsource_file_obj�
first_line�source_lines� r% �QC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\joblib\func_inspect.py�
get_func_code s2
��
�
r'