nxt.runtime module
Code used while a graph is running.
- w(string, quote_type=0)[source]
Wraps given string in quotes.
- Parameters
string (str) – Input string to be wrapped
quote_type (int or str) – Int 1: ‘, 2: “, 3: ‘’’, 4: “”” Default is 1, any string can also be provided and we will wrap the string arg in that string ie w(‘Hello World’, ‘$’) returns ‘$Hello World$’.
- Returns
String wrapped in quote marks or custom string
- execute(paths=(), start=None, parameters=None)[source]
While within node code, this method runs other parts of the graph, allowing non-linear execution.
- Parameters
paths (iterable, optional) – iterable of paths to execute, defaults to ()
start (str, optional) – node path to start from, defaults to None. NOTE must give either paths or start, both is invalid input.
parameters (dict, optional) – parameters dictionary to apply before exectuion, defaults to None
- Raises
GraphError – When there is a problem with execution.
ValueError – When not given either node paths or a start path.
- class Console(_globals=None, _locals=None, filename='<!ignore!>', node_path=None, layer_path=None)[source]
Bases:
code.InteractiveConsole- runcode(c)[source]
Execute a code object.
When an exception occurs, self.showtraceback() is called to display a traceback. All exceptions are caught except SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur elsewhere in this code, and may not always be caught. The caller should be prepared to deal with it.
- get_traceback_lineno(err_depth=0)[source]
Get the line number of one of the errors in the current traceback.
- Parameters
err_depth – index of the error to get line number of. 0 is most
recent, higher values are deeper errors. Defaults to 0 :type err_depth: int, optional :return: line number of requested error :rtype: int
- exception GraphError(err, tb, layer_path, err_path, lineno, bad_line, err_depth=0)[source]
Bases:
Exception
- exception GraphSyntaxError(error, layer_path, error_path, lineno)[source]
Bases:
nxt.runtime.GraphError
- exception InvalidNodeError(node_path)[source]
Bases:
nxt.runtime.GraphError