Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def trace_function(self, func):
# type: (FunctionType) -> FunctionType
new_func = super(BirdsEye, self).trace_function(func)
code_info = self._code_infos.get(new_func.__code__)
if code_info:
return new_func
lines, start_lineno = inspect.getsourcelines(func) # type: List[Text], int
end_lineno = start_lineno + len(lines)
name = safe_qualname(func)
source_file = inspect.getsourcefile(func)
if source_file.startswith('
def all_file_paths(self):
# type: () -> List[str]
with self.session_scope() as session:
paths = [f[0] for f in session.query(self.Function.file).distinct()
if not is_ipython_cell(f[0])]
paths.sort()
if IPYTHON_FILE_PATH in paths:
paths.remove(IPYTHON_FILE_PATH)
paths.insert(0, IPYTHON_FILE_PATH)
return paths
def trace_function(self, func):
# type: (FunctionType) -> FunctionType
new_func = super(BirdsEye, self).trace_function(func)
code_info = self._code_infos.get(new_func.__code__)
if code_info:
return new_func
lines, start_lineno = inspect.getsourcelines(func) # type: List[Text], int
end_lineno = start_lineno + len(lines)
name = safe_qualname(func)
source_file = inspect.getsourcefile(func)
if source_file.startswith('
def all_file_paths(self):
# type: () -> List[str]
with self.session_scope() as session:
paths = [f[0] for f in session.query(self.Function.file).distinct()
if not is_ipython_cell(f[0])]
paths.sort()
if IPYTHON_FILE_PATH in paths:
paths.remove(IPYTHON_FILE_PATH)
paths.insert(0, IPYTHON_FILE_PATH)
return paths
)
).order_by(filtered_calls.c.start_time.desc())
funcs = group_by_attr(query, 'type')
# Add any functions which were never called
all_funcs = sorted(session.query(Function.name, Function.type)
.filter_by(file=path)
.distinct())
func_names = {row.name for row in query}
for func in all_funcs:
if func.name not in func_names:
funcs[func.type].append(func)
return render_template('file.html',
funcs=funcs,
is_ipython=path == IPYTHON_FILE_PATH,
full_path=path,
short_path=basename(path))