Compare commits

...

3 Commits

Author SHA1 Message Date
Jeremy Cohen
a59fe63b19 Fix unit test 2023-04-10 19:01:27 +02:00
Jeremy Cohen
35722dc4cc Add changelog entry 2023-04-10 18:49:01 +02:00
Jeremy Cohen
9603b46667 Add node_info to CompiledNode, ShowNode 2023-04-10 18:46:31 +02:00
7 changed files with 220 additions and 214 deletions

View File

@@ -0,0 +1,6 @@
kind: Under the Hood
body: Add node_info to CompiledNode, ShowNode events
time: 2023-04-10T18:48:53.848405+02:00
custom:
Author: jtcohen6
Issue: "7305"

View File

@@ -1767,7 +1767,7 @@ message CommandCompletedMsg {
// Q041 // Q041
message ShowNode { message ShowNode {
string node_name = 1; NodeInfo node_info = 1;
string preview = 2; string preview = 2;
bool is_inline = 3; bool is_inline = 3;
string output_format = 4; string output_format = 4;
@@ -1780,7 +1780,7 @@ message ShowNodeMsg {
// Q042 // Q042
message CompiledNode { message CompiledNode {
string node_name = 1; NodeInfo node_info = 1;
string compiled = 2; string compiled = 2;
bool is_inline = 3; bool is_inline = 3;
string output_format = 4; string output_format = 4;

View File

@@ -1724,13 +1724,13 @@ class ShowNode(InfoLevel):
return json.dumps({"show": json.loads(self.preview)}, indent=2) return json.dumps({"show": json.loads(self.preview)}, indent=2)
else: else:
return json.dumps( return json.dumps(
{"node": self.node_name, "show": json.loads(self.preview)}, indent=2 {"node": self.node_info.node_name, "show": json.loads(self.preview)}, indent=2
) )
else: else:
if self.is_inline: if self.is_inline:
return f"Previewing inline node:\n{self.preview}" return f"Previewing inline node:\n{self.preview}"
else: else:
return f"Previewing node '{self.node_name}':\n{self.preview}" return f"Previewing node '{self.node_info.node_name}':\n{self.preview}"
class CompiledNode(InfoLevel): class CompiledNode(InfoLevel):

File diff suppressed because one or more lines are too long

View File

@@ -84,7 +84,7 @@ class CompileTask(GraphRunnableTask):
for result in matched_results: for result in matched_results:
fire_event( fire_event(
CompiledNode( CompiledNode(
node_name=result.node.name, node_info=result.node.node_info,
compiled=result.node.compiled_code, compiled=result.node.compiled_code,
is_inline=is_inline, is_inline=is_inline,
output_format=output_format, output_format=output_format,

View File

@@ -77,7 +77,7 @@ class ShowTask(CompileTask):
fire_event( fire_event(
ShowNode( ShowNode(
node_name=result.node.name, node_info=result.node.node_info,
preview=output.getvalue(), preview=output.getvalue(),
is_inline=is_inline, is_inline=is_inline,
output_format=self.args.output, output_format=self.args.output,

View File

@@ -334,8 +334,8 @@ sample_values = [
types.CommandCompleted( types.CommandCompleted(
command="", success=True, elapsed=0.1, completed_at=get_json_string_utcnow() command="", success=True, elapsed=0.1, completed_at=get_json_string_utcnow()
), ),
types.ShowNode(node_name="", preview="", is_inline=True), types.ShowNode(node_info={}, preview="", is_inline=True),
types.CompiledNode(node_name="", compiled="", is_inline=True), types.CompiledNode(node_info={}, compiled="", is_inline=True),
# W - Node testing ====================== # W - Node testing ======================
types.CatchableExceptionOnRun(exc=""), types.CatchableExceptionOnRun(exc=""),
types.InternalErrorOnRun(build_path="", exc=""), types.InternalErrorOnRun(build_path="", exc=""),