Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
lines = re.split(r'[\n]\s*', log)
i = 0
elog = []
for line in lines:
i += 1
e = []
if line[mva.logoffset:].startswith('ERROR'):
e = lines[(max(i - 15, 0)):(min(i + 16, len(lines)))]
elog = elog + e
if len(elog) == 0 and len(output) > lst_len: # no error and LST output
return HTML(output)
elif len(elog) == 0 and len(output) <= lst_len: # no error and no LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log)
elif len(elog) > 0 and len(output) <= lst_len: # error and no LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log)
else: # errors and LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log + output)
def _which_display(mva, log, output):
lst_len = 30762
lines = re.split(r'[\n]\s*', log)
i = 0
elog = []
for line in lines:
i += 1
e = []
if line[mva.logoffset:].startswith('ERROR'):
e = lines[(max(i - 15, 0)):(min(i + 16, len(lines)))]
elog = elog + e
if len(elog) == 0 and len(output) > lst_len: # no error and LST output
return HTML(output)
elif len(elog) == 0 and len(output) <= lst_len: # no error and no LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log)
elif len(elog) > 0 and len(output) <= lst_len: # error and no LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log)
else: # errors and LST
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return HTML(color_log + output)
def _colorLog(self,log:str)-> str:
color_log = highlight(log, SASLogLexer(), HtmlFormatter(full=True, style=SASLogStyle, lineseparator="<br>"))
return color_log