def has_item(self, node: CommandGraphNode, object_type: str, item: str) -> bool: """Check if the given item exists Resolves the available commands for the given command node of the given command type. Performs the resolution of the items through the given IPC client. Parameters ---------- node : CommandGraphNode The node to check for items object_type : str The type of object to check for items. command : str The name of the item to check for Returns ------- bool True if the item is resolved on the given node """ items_call = node.call("items") _, items = self.execute(items_call, (object_type, ), {}) return items is not None and item in items
def has_command(self, node: CommandGraphNode, command: str) -> bool: """Check if the given command exists Resolves the allowed commands over the IPC interface, and returns a boolean indicating of the given command is valid. Parameters ---------- node : CommandGraphNode The node to check for commands command : str The name of the command to check for Returns ------- bool True if the command is resolved on the given node """ cmd_call = node.call("commands") commands = self.execute(cmd_call, (), {}) return command in commands