Commit 9a04879c authored by Lucas Bourneuf's avatar Lucas Bourneuf

improve Script printing

parent e7743cd8
......@@ -91,7 +91,16 @@ class Script:
return call_script(script, context, *args, **kwargs)
def __str__(self):
return f"<Script language={self.language} code={bool(self.source_code)} #lines={len((self.source_code or '').splitlines())} erase={self.erase_context}>"
elements = {
'name': self.name,
'inputs': ','.join(self.inputs()) or None,
'outputs': ','.join(self.outputs()) or None,
'language': self.language,
'has_source_code': bool(self.source_code),
'lines': len((self.source_code or '').splitlines()),
'erase': self.erase_context,
}
return "<Script " + ' '.join(f'{key}={val}' for key, val in elements.items() if val is not None) + '>'
class Module:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment