silence a lot of warnings (#73)

Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/73
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
This commit is contained in:
Lera Elvoé 2024-02-21 06:34:17 +00:00 committed by yagich
parent c3a91d0848
commit df3b3c4990
15 changed files with 34 additions and 32 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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:

View file

@ -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)

View file

@ -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)

View file

@ -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:

View file

@ -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:

View file

@ -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

View file

@ -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)

View file

@ -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:

View file

@ -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)

View file

@ -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":

View file

@ -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())
)

View file

@ -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

View file

@ -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