From c3a91d08485a8a9afa9415b032e233a07c15face Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Wed, 21 Feb 2024 06:11:29 +0000 Subject: [PATCH] replace C-style boolean operators with their keyword counterparts (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes #71 Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/72 Co-authored-by: Lera ElvoƩ Co-committed-by: Lera ElvoƩ --- classes/connections/connections.gd | 4 +- classes/deck/deck.gd | 42 +++++++++---------- classes/deck/deck_holder.gd | 6 +-- classes/deck/deck_node.gd | 10 ++--- classes/deck/node_db.gd | 6 +-- classes/deck/nodes/general/print.gd | 2 +- classes/deck/nodes/general/process_node.gd | 2 +- classes/deck/nodes/general/string_split.gd | 2 +- classes/deck/nodes/group/group_input_node.gd | 2 +- classes/deck/nodes/group/group_node.gd | 6 +-- classes/deck/nodes/group/group_output_node.gd | 2 +- classes/deck/nodes/math/vector_add.gd | 6 +-- classes/deck/nodes/math/vector_decompose.gd | 4 +- classes/deck/nodes/math/vector_dot.gd | 6 +-- classes/deck/nodes/math/vector_multiply.gd | 4 +- classes/deck/nodes/math/vector_normalize.gd | 4 +- classes/deck/nodes/math/vector_subtract.gd | 6 +-- classes/deck/nodes/obs/obs_search_source.gd | 2 +- .../deck/nodes/obs/obs_vector_to_position.gd | 4 +- .../twitch_add_eventsub_subscription.gd | 2 +- .../twitch_remove_eventsub_subscription.gd | 2 +- classes/deck/renderer_persistence.gd | 4 +- classes/deck/search_provider.gd | 2 +- graph_node_renderer/add_node_menu.gd | 8 ++-- graph_node_renderer/deck_holder_renderer.gd | 14 +++---- .../deck_renderer_graph_edit.gd | 10 ++--- graph_node_renderer/tab_container_custom.gd | 2 +- graph_node_renderer/twitch_setup_dialog.gd | 2 +- graph_node_renderer/variable_viewer.gd | 14 +++---- 29 files changed, 90 insertions(+), 90 deletions(-) diff --git a/classes/connections/connections.gd b/classes/connections/connections.gd index bf0d70b..9de3b9c 100644 --- a/classes/connections/connections.gd +++ b/classes/connections/connections.gd @@ -19,7 +19,7 @@ static func _twitch_chat_received(msg_dict : Dictionary): ## Temporary Function for loading generic Connection credentials from user:// as a [CredSaver] Resource static func load_credentials(service : String): - if !FileAccess.file_exists("user://" + service + "_creds.res"): + if not FileAccess.file_exists("user://" + service + "_creds.res"): DeckHolder.logger.log_system("No Credentials exist for " + service + " Service", Logger.LogType.WARN) return null @@ -27,7 +27,7 @@ static func load_credentials(service : String): var creds = ResourceLoader.load("user://" + service + "_creds.res") - if !creds is CredSaver: + if not creds is CredSaver: DeckHolder.logger.log_system("Error loading Credentials for " + service + " Service", Logger.LogType.ERROR) return null diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index af3a043..9216e33 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -85,24 +85,24 @@ func add_node_inst(node: DeckNode, assign_id: String = "", assign_to_self: bool if emit_node_added_signal: node_added.emit(node) - if is_group && emit_group_signals: + if is_group and emit_group_signals: node_added_to_group.emit(node, node._id, assign_to_self, self) node.port_value_updated.connect( func(port_idx: int, new_value: Variant): - if is_group && emit_group_signals: + if is_group and emit_group_signals: node_port_value_updated.emit(node._id, port_idx, new_value, self) ) node.renamed.connect( func(new_name: String): - if is_group && emit_group_signals: + if is_group and emit_group_signals: node_renamed.emit(node._id, new_name, self) ) node.position_updated.connect( func(new_position: Dictionary): - if is_group && emit_group_signals: + if is_group and emit_group_signals: node_moved.emit(node._id, new_position, self) ) @@ -126,14 +126,14 @@ func is_valid_connection(from_node_id: String, to_node_id: String, from_output_p var usage_from: Port.UsageType = from_node.get_output_ports()[from_output_port].usage_type var usage_to: Port.UsageType = to_node.get_input_ports()[to_input_port].usage_type # incompatible usages - if (usage_from != Port.UsageType.BOTH) && (usage_to != Port.UsageType.BOTH): + if (usage_from != Port.UsageType.BOTH) and (usage_to != Port.UsageType.BOTH): if usage_from != usage_to: return false var type_from: DeckType.Types = from_node.get_output_ports()[from_output_port].type var type_to: DeckType.Types = to_node.get_input_ports()[to_input_port].type # incompatible types - if !DeckType.can_convert(type_from, type_to): + if not DeckType.can_convert(type_from, type_to): return false # duplicate connection @@ -145,7 +145,7 @@ func is_valid_connection(from_node_id: String, to_node_id: String, from_output_p ## Attempt to connect two nodes. Returns [code]true[/code] if the connection succeeded. func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: int, to_input_port: int) -> bool: - if !is_valid_connection(from_node_id, to_node_id, from_output_port, to_input_port): + if not is_valid_connection(from_node_id, to_node_id, from_output_port, to_input_port): return false var from_node := get_node(from_node_id) @@ -157,7 +157,7 @@ func connect_nodes(from_node_id: String, to_node_id: String, from_output_port: i var node_out_port: int = connection.values()[0] disconnect_nodes(node_id, to_node_id, node_out_port, to_input_port) - if is_group && emit_group_signals: + if is_group and emit_group_signals: nodes_connected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self) from_node.add_outgoing_connection(from_output_port, to_node._id, to_input_port) @@ -170,7 +170,7 @@ func disconnect_nodes(from_node_id: String, to_node_id: String, from_output_port var to_node := get_node(to_node_id) from_node.remove_outgoing_connection(from_output_port, to_node_id, to_input_port) to_node.remove_incoming_connection(to_input_port) - if is_group && emit_group_signals: + if is_group and emit_group_signals: nodes_disconnected_in_group.emit(from_node_id, to_node_id, from_output_port, to_input_port, self) nodes_disconnected.emit(from_node_id, to_node_id, from_output_port, to_input_port) @@ -178,7 +178,7 @@ func disconnect_nodes(from_node_id: String, to_node_id: String, from_output_port ## Returns true if this deck has no nodes and no variables. func is_empty() -> bool: - return nodes.is_empty() && variable_stack.is_empty() + return nodes.is_empty() and variable_stack.is_empty() ## Remove a node from this deck. @@ -187,10 +187,10 @@ func remove_node(uuid: String, remove_connections: bool = false, force: bool = f if node == null: return - if !node.user_can_delete && !force: + if not node.user_can_delete and not force: return - if node.node_type == "group_node" && !keep_group_instances: + if node.node_type == "group_node" and not keep_group_instances: DeckHolder.close_group_instance(node.group_id, node.group_instance_id) if remove_connections: @@ -211,7 +211,7 @@ func remove_node(uuid: String, remove_connections: bool = false, force: bool = f node_removed.emit(node) - if is_group && emit_group_signals: + if is_group and emit_group_signals: node_removed_from_group.emit(uuid, remove_connections, self) @@ -272,14 +272,14 @@ func group_nodes(nodes_to_group: Array) -> Deck: for from_port: int in outgoing_connections: for to_node: String in outgoing_connections[from_port]: for to_port: int in outgoing_connections[from_port][to_node]: - if !(to_node in node_ids_to_keep): + if to_node not in node_ids_to_keep: disconnect_nodes(node._id, to_node, from_port, to_port) var incoming_connections := node.incoming_connections.duplicate(true) for to_port: int in incoming_connections: for from_node: String in incoming_connections[to_port]: - if !(from_node in node_ids_to_keep): + if from_node not in node_ids_to_keep: disconnect_nodes(from_node, node._id, incoming_connections[to_port][from_node], to_port) midpoint += node.position_as_vector2() @@ -338,12 +338,12 @@ func copy_nodes(nodes_to_copy: Array[String]) -> Dictionary: for from_port: int in outgoing_connections: for to_node: String in outgoing_connections[from_port]: - if !(to_node in nodes_to_copy): + if to_node not in nodes_to_copy: (d.nodes[node].outgoing_connections[from_port] as Dictionary).erase(to_node) var outgoing_is_empty: bool = true for from_port: int in d.nodes[node].outgoing_connections: - if !(d.nodes[node].outgoing_connections[from_port] as Dictionary).is_empty(): + if not (d.nodes[node].outgoing_connections[from_port] as Dictionary).is_empty(): outgoing_is_empty = false break @@ -354,12 +354,12 @@ func copy_nodes(nodes_to_copy: Array[String]) -> Dictionary: for to_port: int in incoming_connections: for from_node: String in incoming_connections[to_port]: - if !(from_node in nodes_to_copy): + if from_node not in nodes_to_copy: (d.nodes[node].incoming_connections[to_port] as Dictionary).erase(from_node) var incoming_is_empty: bool = true for to_port: int in d.nodes[node].incoming_connections: - if !(d.nodes[node].incoming_connections[to_port] as Dictionary).is_empty(): + if not (d.nodes[node].incoming_connections[to_port] as Dictionary).is_empty(): incoming_is_empty = false break @@ -388,7 +388,7 @@ func allocate_ids(count: int) -> Array[String]: func paste_nodes_from_dict(nodes: Dictionary, position: Vector2 = Vector2()) -> void: - if !nodes.get("nodes"): + if not nodes.get("nodes"): return var new_ids := allocate_ids(nodes.nodes.size()) @@ -475,7 +475,7 @@ func to_dict(with_meta: bool = true, group_ids: Array = []) -> Dictionary: for node_id: String in nodes.keys(): inner["nodes"][node_id] = nodes[node_id].to_dict(with_meta) if (nodes[node_id] as DeckNode).node_type == "group_node": - if !(nodes[node_id].group_id in group_ids): + if nodes[node_id].group_id not in group_ids: inner["groups"][nodes[node_id].group_id] = DeckHolder.get_deck(nodes[node_id].group_id).to_dict(with_meta, group_ids) group_ids.append(nodes[node_id].group_id) diff --git a/classes/deck/deck_holder.gd b/classes/deck/deck_holder.gd index 1e2e2bc..fb739e9 100644 --- a/classes/deck/deck_holder.gd +++ b/classes/deck/deck_holder.gd @@ -77,17 +77,17 @@ static func connect_group_signals(group: Deck) -> void: static func get_deck(id: String) -> Deck: - if !decks.has(id): + if not decks.has(id): return null - if !(decks[id] is Dictionary): + if not decks[id] is Dictionary: return decks[id] else: return (decks[id] as Dictionary).values()[0] static func get_group_instance(group_id: String, instance_id: String) -> Deck: - if !decks.has(group_id): + if not decks.has(group_id): return null if decks[group_id] is Dictionary: diff --git a/classes/deck/deck_node.gd b/classes/deck/deck_node.gd index 0036733..45601e1 100644 --- a/classes/deck/deck_node.gd +++ b/classes/deck/deck_node.gd @@ -166,7 +166,7 @@ func add_incoming_connection(to_port: int, from_node: String, from_port: int) -> ## Returns [code]null[/code] if no incoming connection exists on that port. ## The connected node may also return [code]null[/code]. func request_value_async(on_port: int) -> Variant: - if !incoming_connections.has(on_port): + if not incoming_connections.has(on_port): return null var connection: Dictionary = incoming_connections[on_port] @@ -208,15 +208,15 @@ func remove_incoming_connection(to_port: int) -> void: ## Returns [code]true[/code] if the exact connection from this node exists. func has_outgoing_connection_exact(from_port: int, to_node: String, to_port: int) -> bool: - if !outgoing_connections.has(from_port): + if not outgoing_connections.has(from_port): return false var connection: Dictionary = outgoing_connections[from_port] - if !connection.has(to_node): + if not connection.has(to_node): return false var connections_to_node: Array = connection[to_node] - if !(to_port in connections_to_node): + if to_port not in connections_to_node: return false return true @@ -320,7 +320,7 @@ func resolve_input_port_value_async(input_port: int, empty_value: Variant = null var request = await request_value_async(input_port) if request != null: return request - elif get_input_ports()[input_port].value_callback.get_object() && get_input_ports()[input_port].value_callback.call() != empty_value: + elif get_input_ports()[input_port].value_callback.get_object() and get_input_ports()[input_port].value_callback.call() != empty_value: return get_input_ports()[input_port].value_callback.call() elif get_input_ports()[input_port].value != empty_value: return get_input_ports()[input_port].value diff --git a/classes/deck/node_db.gd b/classes/deck/node_db.gd index e12d0a9..67e10cb 100644 --- a/classes/deck/node_db.gd +++ b/classes/deck/node_db.gd @@ -68,7 +68,7 @@ func create_descriptors(path: String) -> void: ## Helper Function that instances a [DeckNode] based off of it's [member DeckNode.node_type] func instance_node(type: String) -> DeckNode: - if !nodes.has(type): + if not nodes.has(type): return null return load(nodes[type]["script_path"]).new() @@ -108,7 +108,7 @@ func load_node_index() -> bool: ## Sets a specific [member DeckNode.node_type] to be a "favorite" for use in ## [AddNodeMenu]. Then stores the updated list of favorites at [member FAVORITE_NODES_PATH] func set_node_favorite(node_type: String, favorite: bool) -> void: - if (favorite && node_type in favorite_nodes) || (!favorite && !(node_type in favorite_nodes)): + if (favorite and node_type in favorite_nodes) or (not favorite and node_type not in favorite_nodes): return if favorite: @@ -122,7 +122,7 @@ func set_node_favorite(node_type: String, favorite: bool) -> void: ## Loads the list of Favorite [memeber DeckNode.node_type]s from [member FAVORITE_NODES_PATH] func load_favorites() -> void: var f := FileAccess.open(FAVORITE_NODES_PATH, FileAccess.READ) - if !f: + if not f: return var data: Array = JSON.parse_string(f.get_as_text()) favorite_nodes.clear() diff --git a/classes/deck/nodes/general/print.gd b/classes/deck/nodes/general/print.gd index 67a5e7f..3f17de6 100644 --- a/classes/deck/nodes/general/print.gd +++ b/classes/deck/nodes/general/print.gd @@ -48,6 +48,6 @@ func _receive(to_input_port: int, data: Variant, extra_data: Array = []) -> void #print(data_to_print) #print("extra data: ", extra_data) DeckHolder.logger.log_node(data_to_print) - if !extra_data.is_empty(): + if not extra_data.is_empty(): DeckHolder.logger.log_node(str("Extra data: ", extra_data)) send(0, true) diff --git a/classes/deck/nodes/general/process_node.gd b/classes/deck/nodes/general/process_node.gd index 90fe1a6..c509312 100644 --- a/classes/deck/nodes/general/process_node.gd +++ b/classes/deck/nodes/general/process_node.gd @@ -34,7 +34,7 @@ func _event_received(event_name: StringName, event_data: Dictionary = {}) -> voi var run = await resolve_input_port_value_async(0) == true - if !run: + if not run: return delta = event_data.delta diff --git a/classes/deck/nodes/general/string_split.gd b/classes/deck/nodes/general/string_split.gd index 5b59da2..ca6c890 100644 --- a/classes/deck/nodes/general/string_split.gd +++ b/classes/deck/nodes/general/string_split.gd @@ -29,7 +29,7 @@ func _init() -> void: func _value_request(on_port: int) -> Variant: var delimiter = await resolve_input_port_value_async(1) - if !delimiter: + if not delimiter: DeckHolder.logger.log_node("Split: could not resolve delimiter. Returning: []", Logger.LogType.ERROR) return [] diff --git a/classes/deck/nodes/group/group_input_node.gd b/classes/deck/nodes/group/group_input_node.gd index f8195c3..4f29d5d 100644 --- a/classes/deck/nodes/group/group_input_node.gd +++ b/classes/deck/nodes/group/group_input_node.gd @@ -41,7 +41,7 @@ func _on_outgoing_connection_removed(port_idx: int) -> void: #if !(outgoing_connections[port] as Array).is_empty(): #last_connected_port = port for port: int in outgoing_connections.keys().slice(1): - if !(outgoing_connections.get(port, {}) as Dictionary).is_empty(): + if not (outgoing_connections.get(port, {}) as Dictionary).is_empty(): last_connected_port = port #prints("l:", last_connected_port, "p:", port_idx) diff --git a/classes/deck/nodes/group/group_node.gd b/classes/deck/nodes/group/group_node.gd index fbcaece..25430fd 100644 --- a/classes/deck/nodes/group/group_node.gd +++ b/classes/deck/nodes/group/group_node.gd @@ -33,12 +33,12 @@ func _pre_connection() -> void: func init_io() -> void: #var group: Deck = _belonging_to.groups.get(group_id) as Deck var group := DeckHolder.get_group_instance(group_id, group_instance_id) - if !group: + if not group: return - if input_node && input_node.ports_updated.is_connected(recalculate_ports): + if input_node and input_node.ports_updated.is_connected(recalculate_ports): input_node.ports_updated.disconnect(recalculate_ports) - if output_node && output_node.ports_updated.is_connected(recalculate_ports): + if output_node and output_node.ports_updated.is_connected(recalculate_ports): output_node.ports_updated.disconnect(recalculate_ports) input_node = group.get_node(group.group_input_node) diff --git a/classes/deck/nodes/group/group_output_node.gd b/classes/deck/nodes/group/group_output_node.gd index 76815a9..9bc90fc 100644 --- a/classes/deck/nodes/group/group_output_node.gd +++ b/classes/deck/nodes/group/group_output_node.gd @@ -39,7 +39,7 @@ func _on_incoming_connection_added(port_idx: int) -> void: func _on_incoming_connection_removed(port_idx: int) -> void: var last_connected_port := 0 for port: int in incoming_connections.keys().slice(1): - if !(incoming_connections[port] as Dictionary).is_empty(): + if not (incoming_connections[port] as Dictionary).is_empty(): last_connected_port = port #prints("l:", last_connected_port, "p:", port_idx) diff --git a/classes/deck/nodes/math/vector_add.gd b/classes/deck/nodes/math/vector_add.gd index 0248445..ed015d9 100644 --- a/classes/deck/nodes/math/vector_add.gd +++ b/classes/deck/nodes/math/vector_add.gd @@ -27,15 +27,15 @@ func _value_request(_on_port: int) -> Variant: var va = await request_value_async(0) var vb = await request_value_async(1) - if !va || !vb: + if not va or not vb: DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): + if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): + if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Add: one of the vectors is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/math/vector_decompose.gd b/classes/deck/nodes/math/vector_decompose.gd index 89cabb3..aee3c05 100644 --- a/classes/deck/nodes/math/vector_decompose.gd +++ b/classes/deck/nodes/math/vector_decompose.gd @@ -26,11 +26,11 @@ func _init() -> void: func _value_request(on_port: int) -> Variant: var v = await request_value_async(0) - if !v: + if not v: DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR) return null - if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): + if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Decompose: the vector is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/math/vector_dot.gd b/classes/deck/nodes/math/vector_dot.gd index 3763b4c..e0ee5a4 100644 --- a/classes/deck/nodes/math/vector_dot.gd +++ b/classes/deck/nodes/math/vector_dot.gd @@ -28,15 +28,15 @@ func _value_request(_on_port: int) -> Variant: var va = await request_value_async(0) var vb = await request_value_async(1) - if !va || !vb: + if not va or not vb: DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): + if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): + if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Dot: one of the vectors is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/math/vector_multiply.gd b/classes/deck/nodes/math/vector_multiply.gd index 9d415f2..0654b87 100644 --- a/classes/deck/nodes/math/vector_multiply.gd +++ b/classes/deck/nodes/math/vector_multiply.gd @@ -28,11 +28,11 @@ func _init() -> void: func _value_request(_on_port: int) -> Variant: var v = await request_value_async(0) - if !v: + if not v: DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR) return null - if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): + if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Mult: the vector is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/math/vector_normalize.gd b/classes/deck/nodes/math/vector_normalize.gd index 327593a..2f0f69c 100644 --- a/classes/deck/nodes/math/vector_normalize.gd +++ b/classes/deck/nodes/math/vector_normalize.gd @@ -22,11 +22,11 @@ func _init() -> void: func _value_request(_on_port: int) -> Variant: var v = await request_value_async(0) - if !v: + if not v: DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR) return null - if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): + if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Normalize: the vector is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/math/vector_subtract.gd b/classes/deck/nodes/math/vector_subtract.gd index 8867fed..cc33038 100644 --- a/classes/deck/nodes/math/vector_subtract.gd +++ b/classes/deck/nodes/math/vector_subtract.gd @@ -27,15 +27,15 @@ func _value_request(_on_port: int) -> Variant: var va = await request_value_async(0) var vb = await request_value_async(1) - if !va || !vb: + if not va or not vb: DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(va as Dictionary).has("x") || !(va as Dictionary).has("y"): + if not (va as Dictionary).has("x") or not (va as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) return null - if !(vb as Dictionary).has("x") || !(vb as Dictionary).has("y"): + if not (vb as Dictionary).has("x") or not (vb as Dictionary).has("y"): DeckHolder.logger.log_node("Vector Sub: one of the vectors is invalid.", Logger.LogType.ERROR) return null diff --git a/classes/deck/nodes/obs/obs_search_source.gd b/classes/deck/nodes/obs/obs_search_source.gd index 7215863..4e67508 100644 --- a/classes/deck/nodes/obs/obs_search_source.gd +++ b/classes/deck/nodes/obs/obs_search_source.gd @@ -48,7 +48,7 @@ func _value_request(_on_output_port: int) -> Variant: var scene_name: String = scene_name_req var source_name: String = source_name_req - if cached_scene_name == scene_name && cached_source_name == scene_name: + if cached_scene_name == scene_name and cached_source_name == scene_name: return cached_id cached_scene_name = scene_name diff --git a/classes/deck/nodes/obs/obs_vector_to_position.gd b/classes/deck/nodes/obs/obs_vector_to_position.gd index 4d82a18..3b4cbd9 100644 --- a/classes/deck/nodes/obs/obs_vector_to_position.gd +++ b/classes/deck/nodes/obs/obs_vector_to_position.gd @@ -21,10 +21,10 @@ func _init() -> void: func _value_request(_on_port: int) -> Variant: var v = await request_value_async(0) - if !v: + if not v: return null - if !(v as Dictionary).has("x") || !(v as Dictionary).has("y"): + if not (v as Dictionary).has("x") or not (v as Dictionary).has("y"): return null return {"position_x": v.x, "position_y": v.y} diff --git a/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd b/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd index 7258f0f..f7fd826 100644 --- a/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd +++ b/classes/deck/nodes/twitch/twitch_add_eventsub_subscription.gd @@ -33,7 +33,7 @@ func _receive(to_input_port, data: Variant, extra_data: Array = []): var input_data = await resolve_input_port_value_async(1) - if input_data == null or !"condition" in input_data.keys(): + if input_data == null or "condition" not in input_data.keys(): DeckHolder.logger.log_node(name + ": Incorrect Subscription Data Connected, please supply a Dictionary with condition and if needed, version. Last supplied Data was: " + str(input_data), Logger.LogType.ERROR) return diff --git a/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd b/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd index c927e55..86334d7 100644 --- a/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd +++ b/classes/deck/nodes/twitch/twitch_remove_eventsub_subscription.gd @@ -19,7 +19,7 @@ func _init(): func _receive(to_input_port, data: Variant, extra_data: Array = []): - if !to_input_port == 1: + if to_input_port != 1: return diff --git a/classes/deck/renderer_persistence.gd b/classes/deck/renderer_persistence.gd index 1b9ca97..df1de1c 100644 --- a/classes/deck/renderer_persistence.gd +++ b/classes/deck/renderer_persistence.gd @@ -79,7 +79,7 @@ static func erase(name_space: String, channel: String, key: String) -> Variant: ## Commits the [param channel] to the filesystem. If [param channel] is empty, ## commits all channels in the [param name_space]. static func commit(name_space: String, channel: String = "") -> void: - if !channel.is_empty(): + if not channel.is_empty(): _commit_channel(name_space, channel) else: for c: String in _data[name_space]: @@ -104,7 +104,7 @@ static func _create_namespace_folder(name_space: String) -> Error: static func _lazy_load_channel(name_space: String, channel: String) -> void: var validated_name := name_space.validate_filename() var validated_channel := channel.validate_filename() - if !_data.has(validated_name): + if not _data.has(validated_name): DeckHolder.logger.log_system("Namespace %s is not initialized" % name_space, Logger.LogType.ERROR) return diff --git a/classes/deck/search_provider.gd b/classes/deck/search_provider.gd index b207758..6567fdd 100644 --- a/classes/deck/search_provider.gd +++ b/classes/deck/search_provider.gd @@ -65,7 +65,7 @@ static func search(term: String) -> Array[NodeDB.NodeDescriptor]: for node_type: String in NodeDB.nodes: var nd: NodeDB.NodeDescriptor = NodeDB.nodes[node_type] - if !nd.appears_in_search: + if not nd.appears_in_search: continue var full_search_string := nd.name + nd.aliases diff --git a/graph_node_renderer/add_node_menu.gd b/graph_node_renderer/add_node_menu.gd index 3b8da83..c3517fc 100644 --- a/graph_node_renderer/add_node_menu.gd +++ b/graph_node_renderer/add_node_menu.gd @@ -47,7 +47,7 @@ func add_category_item(category: String, item: String, tooltip: String = "", fav ## Wrapper around [method add_category_item] and [method add_category]. Adds an item to a [param category], creating the category if it doesn't exist yet. func add_item(category: String, item: String, tooltip: String = "", favorite: bool = false) -> void: - if !categories.has(category): + if not categories.has(category): add_category(category) add_category_item(category, item, tooltip, favorite) @@ -142,7 +142,7 @@ func get_next_visible_category(at: int) -> Category: while s < scroll_content_container.get_child_count(): i = (i + 1) % scroll_content_container.get_child_count() - if !(scroll_content_container.get_child(i) as Category).is_collapsed(): + if not (scroll_content_container.get_child(i) as Category).is_collapsed(): return scroll_content_container.get_child(i) s += 1 @@ -157,7 +157,7 @@ func get_previous_visible_category(at: int) -> Category: while s < scroll_content_container.get_child_count(): i = (i - 1) % scroll_content_container.get_child_count() - if !(scroll_content_container.get_child(i) as Category).is_collapsed(): + if not (scroll_content_container.get_child(i) as Category).is_collapsed(): return scroll_content_container.get_child(i) s += 1 @@ -227,7 +227,7 @@ class Category extends VBoxContainer: collapse_button.icon = COLLAPSE_ICON_COLLAPSED if collapsed else COLLAPSE_ICON collapse_button.set_pressed_no_signal(collapsed) for c: CategoryItem in get_children(): - c.visible = !collapsed + c.visible = not collapsed ## Add an item to the category. diff --git a/graph_node_renderer/deck_holder_renderer.gd b/graph_node_renderer/deck_holder_renderer.gd index 1ac669c..99e9f2a 100644 --- a/graph_node_renderer/deck_holder_renderer.gd +++ b/graph_node_renderer/deck_holder_renderer.gd @@ -82,7 +82,7 @@ func _ready() -> void: ) get_tree().get_root().gui_embed_subwindows = embed_subwindows - file_dialog.use_native_dialog = !embed_subwindows + file_dialog.use_native_dialog = not embed_subwindows recent_files = RendererPersistence.get_or_create( PERSISTENCE_NAMESPACE, "config", @@ -96,7 +96,7 @@ func _ready() -> void: tab_container.tab_close_requested.connect( func(tab: int): - if tab_container.get_tab_metadata(tab, "dirty") && !tab_container.get_tab_metadata(tab, "group"): + if tab_container.get_tab_metadata(tab, "dirty") and not tab_container.get_tab_metadata(tab, "group"): unsaved_changes_dialog_single_deck.set_meta("tab", tab) unsaved_changes_dialog_single_deck.show() return @@ -181,7 +181,7 @@ func close_current_tab() -> void: func close_tab(tab: int) -> void: - if !tab_container.get_tab_metadata(tab, "group"): + if not tab_container.get_tab_metadata(tab, "group"): var groups := DeckHolder.close_deck(tab_container.get_tab_metadata(tab, "id")) # close tabs associated with this deck's groups for group in groups: @@ -217,7 +217,7 @@ func open_open_dialog(path: String) -> void: ## Saves the selected [Deck] if it still exists. func _on_file_dialog_save_file(path: String) -> void: var deck: Deck = _deck_to_save.get_ref() as Deck - if !deck: + if not deck: return deck.save_path = path @@ -369,9 +369,9 @@ func _on_debug_id_pressed(id: int) -> void: d.popup_centered() DebugMenuId.EMBED_SUBWINDOWS: var c := debug_popup_menu.is_item_checked(id) - debug_popup_menu.set_item_checked(id, !c) - get_tree().get_root().gui_embed_subwindows = !c - RendererPersistence.set_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", !c) + debug_popup_menu.set_item_checked(id, not c) + get_tree().get_root().gui_embed_subwindows = not c + RendererPersistence.set_value(PERSISTENCE_NAMESPACE, "config", "embed_subwindows", not c) file_dialog.use_native_dialog = c diff --git a/graph_node_renderer/deck_renderer_graph_edit.gd b/graph_node_renderer/deck_renderer_graph_edit.gd index 02095d3..02df6a3 100644 --- a/graph_node_renderer/deck_renderer_graph_edit.gd +++ b/graph_node_renderer/deck_renderer_graph_edit.gd @@ -204,7 +204,7 @@ func get_selected_nodes() -> Array: ## Executes functionality based off hotkey inputs. Specifically handles creating groups ## based off the action "group_nodes". func _gui_input(event: InputEvent) -> void: - if event.is_action_pressed("group_nodes") && get_selected_nodes().size() > 0: + if event.is_action_pressed("group_nodes") and get_selected_nodes().size() > 0: clear_connections() var nodes = get_selected_nodes().map( func(x: DeckNodeRendererGraphNode): @@ -214,7 +214,7 @@ func _gui_input(event: InputEvent) -> void: refresh_connections() get_viewport().set_input_as_handled() - if event.is_action_pressed("rename_node") && get_selected_nodes().size() == 1: + if event.is_action_pressed("rename_node") and get_selected_nodes().size() == 1: var node: DeckNodeRendererGraphNode = get_selected_nodes()[0] var pos := get_viewport_rect().position + get_global_mouse_position() rename_popup.popup_on_parent(Rect2i(pos, rename_popup_size)) @@ -225,11 +225,11 @@ func _gui_input(event: InputEvent) -> void: ## Handles entering groups with action "enter_group". Done here to bypass neighbor ## functionality. func _input(event: InputEvent) -> void: - if !has_focus(): + if not has_focus(): return - if event.is_action_pressed("enter_group") && get_selected_nodes().size() == 1: - if !((get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.node_type == "group_node"): + if event.is_action_pressed("enter_group") and get_selected_nodes().size() == 1: + if (get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.node_type != "group_node": return group_enter_requested.emit((get_selected_nodes()[0] as DeckNodeRendererGraphNode).node.group_id) get_viewport().set_input_as_handled() diff --git a/graph_node_renderer/tab_container_custom.gd b/graph_node_renderer/tab_container_custom.gd index 2dedab2..9beeb76 100644 --- a/graph_node_renderer/tab_container_custom.gd +++ b/graph_node_renderer/tab_container_custom.gd @@ -101,7 +101,7 @@ func is_empty() -> bool: ## Closes a tab at the index [param tab]. func close_tab(tab: int) -> void: - if !tab_bar.select_previous_available(): + if not tab_bar.select_previous_available(): tab_bar.select_next_available() content_container.get_child(tab).queue_free() _tab_metadata.remove_at(tab) diff --git a/graph_node_renderer/twitch_setup_dialog.gd b/graph_node_renderer/twitch_setup_dialog.gd index 05d8dfe..b480224 100644 --- a/graph_node_renderer/twitch_setup_dialog.gd +++ b/graph_node_renderer/twitch_setup_dialog.gd @@ -43,7 +43,7 @@ func copy_auth_link(): func connect_to_chat(): - if !Connections.twitch.get("chat_socket") or Connections.twitch.chat_socket.get_ready_state() != WebSocketPeer.STATE_OPEN: + if not Connections.twitch.get("chat_socket") or Connections.twitch.chat_socket.get_ready_state() != WebSocketPeer.STATE_OPEN: Connections.twitch.setup_chat_connection(%Default_Chat.text) return diff --git a/graph_node_renderer/variable_viewer.gd b/graph_node_renderer/variable_viewer.gd index 4aa44a4..6fff892 100644 --- a/graph_node_renderer/variable_viewer.gd +++ b/graph_node_renderer/variable_viewer.gd @@ -69,7 +69,7 @@ func commit_item_change(item: TreeItem = variable_tree.get_edited()) -> void: _: new_value = item.get_meta(&"value") - if !item.has_meta(&"container"): + if not item.has_meta(&"container"): top_field_edited.emit(_old_name, new_name, new_value) else: var container = item.get_meta(&"container") @@ -93,13 +93,13 @@ func edit_item() -> void: # do nothing if this is an array and user is trying to edit index # (TODO: proper reordering) - if column == 0 && item.get_meta(&"indexed"): + if column == 0 and item.get_meta(&"indexed"): return if column < 2: var value = item.get_meta(&"value") - if column == 1 && (value is Array || value is Dictionary): - item.collapsed = !item.collapsed + if column == 1 and (value is Array or value is Dictionary): + item.collapsed = not item.collapsed return _old_name = item.get_text(0) @@ -207,7 +207,7 @@ func _on_variable_tree_button_clicked(item: TreeItem, column: int, id: int, mous # we only have a delete button for now, so assume it is what's clicked - if !item.has_meta(&"container"): + if not item.has_meta(&"container"): var key := item.get_text(0) top_field_removed.emit(key) item.free() @@ -259,7 +259,7 @@ func _on_types_popup_id_pressed(id: int) -> void: current_item.set_text(2, DeckType.type_str(id)) - if !current_item.has_meta(&"container"): + if not current_item.has_meta(&"container"): var field_name := current_item.get_text(0) top_field_edited.emit(field_name, field_name, new_value) @@ -268,7 +268,7 @@ func _on_new_variable_button_pressed() -> void: var selected := variable_tree.get_selected() # TODO: UX impr. - if selected is part of a container, add to that container instead # (but if selected is a container, prioritize adding to that) - if selected == null || !(selected.get_meta(&"value") is Array || selected.get_meta(&"value") is Dictionary): + if selected == null or not (selected.get_meta(&"value") is Array or selected.get_meta(&"value") is Dictionary): # top field var var_name := "new_variable%s" % variable_tree.get_root().get_child_count() var new_item := add_item(var_name, "")