MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / write

Method write

python/scriptingprovider.py:503–538  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

501 return self.write('\n'.join(lines))
502
503 def write(self, data):
504 interpreter = None
505 if hasattr(PythonScriptingInstance._interpreter, "value"):
506 interpreter = PythonScriptingInstance._interpreter.value
507
508 if interpreter is None:
509 if log.is_output_redirected_to_log():
510 self.buffer += data
511 while True:
512 i = self.buffer.find('\n')
513 if i == -1:
514 break
515 line = self.buffer[:i]
516 self.buffer = self.buffer[i + 1:]
517
518 if self.is_error_output:
519 if _WARNING_REGEX.match(line):
520 logger.log_warn(line)
521 else:
522 logger.log_error(line)
523 else:
524 logger.log_info(line)
525 else:
526 self.orig.write(data)
527 else:
528 PythonScriptingInstance._interpreter.value = None
529 try:
530 if self.is_error_output:
531 if _WARNING_REGEX.match(data):
532 interpreter.instance.warning(data)
533 else:
534 interpreter.instance.error(data)
535 else:
536 interpreter.instance.output(data)
537 finally:
538 PythonScriptingInstance._interpreter.value = interpreter
539
540
541class _PythonScriptingInstanceInput:

Callers 5

writelinesMethod · 0.95
__setitem__Method · 0.45
__init__Method · 0.45
apply_localsMethod · 0.45
write_at_cursorMethod · 0.45

Calls 8

findMethod · 0.80
matchMethod · 0.80
log_warnMethod · 0.80
log_errorMethod · 0.80
log_infoMethod · 0.80
warningMethod · 0.80
errorMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected