Submit
Path:
~
/
/
proc
/
thread-self
/
root
/
opt
/
alt
/
python35
/
lib
/
python3.5
/
site-packages
/
joblib
/
__pycache__
/
File Content:
func_inspect.cpython-35.opt-1.pyc
ש�W&3 � @ s d Z d d l m Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d � Z d d � Z d d d d � Z d d � Z d d � Z d d � Z f e � d d � Z d d � Z d d d � Z d S)z> My own variation on function-specific inspect-like features. � )�isliceN� )�_basestring)�pformat)�open_py_source)�PY3_OR_LATERc C sG d } y� | j } | j } t j j | � s� d j t j | � d � } d } | j d � r� t j d | � j � \ } } t | � } d | } | | | f St | � �, } | j } t t | | d d � � } Wd QRXd j t j | � � | | f SWnF t | d � r+t | j j � � | d f St | � | d f SYn Xd S)al 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 )r �co_filename�os�path�exists�join�inspectZgetsourcelines� startswith�re�match�groups�intr �co_firstlineno�listr Zgetblock�hasattr�str�__hash__�repr)�funcZsource_file�codeZsource_codeZline_noZsource_file_objZ first_lineZsource_lines� r �/func_inspect.py� get_func_code s* ##r c C sl d d l } t | d � r'