From df3b3c4990729198881004b9f6fe19831a9dfe90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 21 Feb 2024 06:34:17 +0000 Subject: [PATCH] silence a lot of warnings (#73) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/73 Co-authored-by: Lera ElvoƩ Co-committed-by: Lera ElvoƩ --- classes/deck/deck.gd | 36 +++++++++---------- classes/deck/nodes/general/array_get_index.gd | 2 +- classes/deck/nodes/general/is_equal.gd | 4 +-- classes/deck/nodes/general/string_split.gd | 2 +- .../twitch_add_eventsub_subscription.gd | 3 +- classes/deck/nodes/twitch/twitch_join_chat.gd | 2 +- .../deck/nodes/twitch/twitch_leave_chat.gd | 2 +- .../twitch_remove_eventsub_subscription.gd | 4 +-- .../nodes/twitch/twitch_request_user_info.gd | 2 +- classes/deck/nodes/twitch/twitch_send_chat.gd | 2 +- graph_node_renderer/deck_holder_renderer.gd | 1 + .../deck_node_renderer_graph_node.gd | 2 +- graph_node_renderer/logger_renderer.gd | 1 - .../obs_websocket_setup_dialog.gd | 1 + graph_node_renderer/variable_viewer.gd | 2 +- 15 files changed, 34 insertions(+), 32 deletions(-) diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index 9216e33..094f6fb 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -387,40 +387,40 @@ func allocate_ids(count: int) -> Array[String]: return res -func paste_nodes_from_dict(nodes: Dictionary, position: Vector2 = Vector2()) -> void: - if not nodes.get("nodes"): +func paste_nodes_from_dict(nodes_to_paste: Dictionary, position: Vector2 = Vector2()) -> void: + if not nodes_to_paste.get("nodes"): return - var new_ids := allocate_ids(nodes.nodes.size()) + var new_ids := allocate_ids(nodes_to_paste.nodes.size()) var ids_map := {} - for i: int in nodes.nodes.keys().size(): - var node_id: String = nodes.nodes.keys()[i] + for i: int in nodes_to_paste.nodes.keys().size(): + var node_id: String = nodes_to_paste.nodes.keys()[i] ids_map[node_id] = new_ids[i] - for node_id: String in nodes.nodes: - nodes.nodes[node_id]._id = ids_map[node_id] + for node_id: String in nodes_to_paste.nodes: + nodes_to_paste.nodes[node_id]._id = ids_map[node_id] - nodes.nodes[node_id].position.x += position.x - nodes.nodes[node_id].position.y += position.y + nodes_to_paste.nodes[node_id].position.x += position.x + nodes_to_paste.nodes[node_id].position.y += position.y - var outgoing_connections: Dictionary = nodes.nodes[node_id].outgoing_connections as Dictionary + var outgoing_connections: Dictionary = nodes_to_paste.nodes[node_id].outgoing_connections as Dictionary var outgoing_connections_res := {} for from_port in outgoing_connections: outgoing_connections_res[from_port] = {} for to_node_id in outgoing_connections[from_port]: outgoing_connections_res[from_port][ids_map[to_node_id]] = outgoing_connections[from_port][to_node_id] - var incoming_connections: Dictionary = nodes.nodes[node_id].incoming_connections as Dictionary + var incoming_connections: Dictionary = nodes_to_paste.nodes[node_id].incoming_connections as Dictionary var incoming_connections_res := {} for to_port in incoming_connections: incoming_connections_res[to_port] = {} for from_node_id in incoming_connections[to_port]: incoming_connections_res[to_port][ids_map[from_node_id]] = incoming_connections[to_port][from_node_id] - nodes.nodes[node_id].outgoing_connections = outgoing_connections_res - nodes.nodes[node_id].incoming_connections = incoming_connections_res + nodes_to_paste.nodes[node_id].outgoing_connections = outgoing_connections_res + nodes_to_paste.nodes[node_id].incoming_connections = incoming_connections_res - var node := DeckNode.from_dict(nodes.nodes[node_id]) + var node := DeckNode.from_dict(nodes_to_paste.nodes[node_id]) if node.node_type == "group_node": var group := DeckHolder.make_new_group_instance(node.group_id) node.group_instance_id = group.instance_id @@ -436,12 +436,12 @@ func paste_nodes_from_json(json: String, position: Vector2 = Vector2()) -> void: paste_nodes_from_dict(JSON.parse_string(json), position) -func duplicate_nodes(nodes: Array[String]) -> void: - if nodes.is_empty(): +func duplicate_nodes(nodes_to_copy: Array[String]) -> void: + if nodes_to_copy.is_empty(): return - var position := get_node(nodes[0]).position_as_vector2() + Vector2(50, 50) - var d := copy_nodes(nodes) + var position := get_node(nodes_to_copy[0]).position_as_vector2() + Vector2(50, 50) + var d := copy_nodes(nodes_to_copy) paste_nodes_from_dict(d, position) diff --git a/classes/deck/nodes/general/array_get_index.gd b/classes/deck/nodes/general/array_get_index.gd index 7d9a18d..46c746d 100644 --- a/classes/deck/nodes/general/array_get_index.gd +++ b/classes/deck/nodes/general/array_get_index.gd @@ -26,7 +26,7 @@ func _init() -> void: ) -func _value_request(on_port: int) -> Variant: +func _value_request(_on_port: int) -> Variant: var arr = await request_value_async(0) if arr == null: DeckHolder.logger.log_node("Array index: Input array is null. Returning null.", Logger.LogType.ERROR) diff --git a/classes/deck/nodes/general/is_equal.gd b/classes/deck/nodes/general/is_equal.gd index 674eb40..b819427 100644 --- a/classes/deck/nodes/general/is_equal.gd +++ b/classes/deck/nodes/general/is_equal.gd @@ -27,14 +27,14 @@ func _init() -> void: ) -func _value_request(on_port: int) -> Variant: +func _value_request(_on_port: int) -> Variant: var a = await resolve_input_port_value_async(0) var b = await resolve_input_port_value_async(1) return a == b -func _receive(on_port: int, data: Variant, extra_data: Array = []) -> void: +func _receive(on_port: int, data: Variant, _extra_data: Array = []) -> void: if on_port == 0: var b = await resolve_input_port_value_async(1) if data == b: diff --git a/classes/deck/nodes/general/string_split.gd b/classes/deck/nodes/general/string_split.gd index ca6c890..9aa3e3c 100644 --- a/classes/deck/nodes/general/string_split.gd +++ b/classes/deck/nodes/general/string_split.gd @@ -27,7 +27,7 @@ func _init() -> void: ) -func _value_request(on_port: int) -> Variant: +func _value_request(_on_port: int) -> Variant: var delimiter = await resolve_input_port_value_async(1) if not delimiter: DeckHolder.logger.log_node("Split: could not resolve delimiter. Returning: []", Logger.LogType.ERROR) diff --git a/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd b/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd index f7fd826..33d8e2a 100644 --- a/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd +++ b/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd @@ -23,7 +23,7 @@ func _init(): -func _receive(to_input_port, data: Variant, extra_data: Array = []): +func _receive(to_input_port, _data: Variant, _extra_data: Array = []): if to_input_port != 2: @@ -67,6 +67,7 @@ func eventsub_subscription_response(data): _: + @warning_ignore("shadowed_global_identifier") var error_string = name + ": Error" + data.code + " Received from Twitch when Subscribing to " + subscription_data.sub_type + " with " + str(subscription_data.return_request_dictionary) DeckHolder.logger.log_node(error_string, Logger.LogType.ERROR) diff --git a/classes/deck/nodes/twitch/twitch_join_chat.gd b/classes/deck/nodes/twitch/twitch_join_chat.gd index ee45d30..93c1102 100644 --- a/classes/deck/nodes/twitch/twitch_join_chat.gd +++ b/classes/deck/nodes/twitch/twitch_join_chat.gd @@ -19,7 +19,7 @@ func _init(): -func _receive(to_input_port, data: Variant, extra_data: Array = []): +func _receive(to_input_port, _data: Variant, _extra_data: Array = []): if to_input_port != 1: diff --git a/classes/deck/nodes/twitch/twitch_leave_chat.gd b/classes/deck/nodes/twitch/twitch_leave_chat.gd index c053ab6..5f727b4 100644 --- a/classes/deck/nodes/twitch/twitch_leave_chat.gd +++ b/classes/deck/nodes/twitch/twitch_leave_chat.gd @@ -19,7 +19,7 @@ func _init(): -func _receive(to_input_port, data: Variant, extra_data: Array = []): +func _receive(to_input_port, _data: Variant, _extra_data: Array = []): if to_input_port != 1: diff --git a/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd b/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd index 86334d7..f8c0021 100644 --- a/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd +++ b/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd @@ -17,7 +17,7 @@ func _init(): -func _receive(to_input_port, data: Variant, extra_data: Array = []): +func _receive(to_input_port, _data: Variant, _extra_data: Array = []): if to_input_port != 1: @@ -29,7 +29,7 @@ func _receive(to_input_port, data: Variant, extra_data: Array = []): Connections.twitch.remove_eventsub_subscription_type(sub_type).response_completed.connect(eventsub_response_received) -func eventsub_response_received(info): +func eventsub_response_received(_info): pass # TODO: Add Error Handling Later diff --git a/classes/deck/nodes/twitch/twitch_request_user_info.gd b/classes/deck/nodes/twitch/twitch_request_user_info.gd index cd1319f..d97fa0f 100644 --- a/classes/deck/nodes/twitch/twitch_request_user_info.gd +++ b/classes/deck/nodes/twitch/twitch_request_user_info.gd @@ -40,7 +40,7 @@ func switch_user_input_type(value): -func _value_request(from_port): +func _value_request(_from_port): var user_input = await resolve_input_port_value_async(0) var as_id = await resolve_input_port_value_async(1) diff --git a/classes/deck/nodes/twitch/twitch_send_chat.gd b/classes/deck/nodes/twitch/twitch_send_chat.gd index 9db5a58..59fc7ab 100644 --- a/classes/deck/nodes/twitch/twitch_send_chat.gd +++ b/classes/deck/nodes/twitch/twitch_send_chat.gd @@ -28,7 +28,7 @@ func _init(): -func _receive(to_input_port, data: Variant, extra_data: Array = []): +func _receive(to_input_port, _data: Variant, _extra_data: Array = []): if to_input_port != 2: diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index 99e9f2a..5e2aeb6 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -447,6 +447,7 @@ func add_recents_to_menu() -> void: file_popup_menu.add_item(file) var s := Shortcut.new() var k := InputEventKey.new() + @warning_ignore("int_as_enum_without_cast") k.keycode = KEY_1 + i k.ctrl_pressed = true s.events.append(k) diff --git a/graph_node_renderer/deck_node_renderer_graph_node.gd b/graph_node_renderer/deck_node_renderer_graph_node.gd index d5131f6..0d764b3 100644 --- a/graph_node_renderer/deck_node_renderer_graph_node.gd +++ b/graph_node_renderer/deck_node_renderer_graph_node.gd @@ -150,7 +150,7 @@ func update_port(port: Port) -> void: port.value_callback = func(): return box.get_item_text(box.get_selected_id()) if port.type == DeckType.Types.STRING: box.item_selected.connect( - func(id: int): + func(_id: int): port.set_value.call(box.get_item_text(box.get_selected_id())) ) "codeblock": diff --git a/graph_node_renderer/logger_renderer.gd b/graph_node_renderer/logger_renderer.gd index 5b2477a..b5c9967 100644 --- a/graph_node_renderer/logger_renderer.gd +++ b/graph_node_renderer/logger_renderer.gd @@ -28,7 +28,6 @@ func _ready() -> void: # the copy button is disabled for now because it doesnt work copy_button.pressed.connect( func(): - var c = output_label.get_text() DisplayServer.clipboard_set(output_label.get_text()) ) diff --git a/graph_node_renderer/obs_websocket_setup_dialog.gd b/graph_node_renderer/obs_websocket_setup_dialog.gd index 13ac783..6eb2fdb 100644 --- a/graph_node_renderer/obs_websocket_setup_dialog.gd +++ b/graph_node_renderer/obs_websocket_setup_dialog.gd @@ -17,6 +17,7 @@ enum ConnectionState { } var state: ConnectionState +@warning_ignore("narrowing_conversion") @onready var _old_port: int = port_spin_box.value @onready var _old_password: String = password_line_edit.text diff --git a/graph_node_renderer/variable_viewer.gd b/graph_node_renderer/variable_viewer.gd index 6fff892..c46d7c4 100644 --- a/graph_node_renderer/variable_viewer.gd +++ b/graph_node_renderer/variable_viewer.gd @@ -201,7 +201,7 @@ func refresh_item_value(item: TreeItem) -> void: item.set_text(1, str(value)) -func _on_variable_tree_button_clicked(item: TreeItem, column: int, id: int, mouse_button_index: int) -> void: +func _on_variable_tree_button_clicked(item: TreeItem, _column: int, _id: int, mouse_button_index: int) -> void: if mouse_button_index != MOUSE_BUTTON_LEFT: return