def __get_source(self, func):
"""Fetches source of the function"""
hashf = hash(func)
if hashf not in self.__sourcesHM:
#get lines of the source and adjust indent
sourcelines = inspect.getsourcelines(func)[0]
#remove indentation from the first line
sourcelines[0] = sourcelines[0].lstrip()
self.__sourcesHM[hashf] = "".join(sourcelines)
return self.__sourcesHM[hashf]
评论列表
文章目录