Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
in_script = Script(fname)
logger.debug('Parsing script %s', in_script)
self.scripts.append(in_script)
self.scripts_by_fname[fname] = in_script
next_line = next(file_object)
m = RE_SOURCED_TIMES.match(next_line)
in_script.sourced_count = int(m.group(1))
plnum += skip_to_count_header() + 1
lnum = 0
elif line.startswith('FUNCTION '):
func_name = line[10:-2]
in_function = Function(name=func_name)
logger.debug('Parsing function %s', in_function)
while True:
next_line = next(file_object)
if not next_line:
break
plnum += 1
if next_line.startswith('count'):
break
if next_line.startswith(' Defined:'):
defined = next_line[13:]
fname, _, lnum = defined.rpartition(":")
# NOTE: fname may be a drive letter on Windows.
if len(fname) <= 1:
fname, _, lnum = defined.rpartition(' line ')
fname = os.path.expanduser(fname)
in_function.source = (self.scripts_by_fname[fname],
int(lnum))
# Parse line 1 always, as a workaround for
# https://github.com/vim/vim/issues/2103.
in_script.parse_function(lnum, source_line)
else:
if count is None:
if is_executable_line(source_line):
# Functions do not have continued lines, assume 0.
count = 0
line = Line(line=source_line, count=count,
total_time=total_time, self_time=self_time)
in_function.lines[lnum] = line
elif line.startswith('SCRIPT '):
fname = line[8:]
in_script = Script(fname)
logger.debug('Parsing script %s', in_script)
self.scripts.append(in_script)
self.scripts_by_fname[fname] = in_script
next_line = next(file_object)
m = RE_SOURCED_TIMES.match(next_line)
in_script.sourced_count = int(m.group(1))
plnum += skip_to_count_header() + 1
lnum = 0
elif line.startswith('FUNCTION '):
func_name = line[10:-2]
in_function = Function(name=func_name)
logger.debug('Parsing function %s', in_function)
while True:
next_line = next(file_object)