import typing


def get_gate_parameter(string: str) -> typing.Union[float, str]:
	"""
	Gets a parameter from a gate.

	Parameters
	----------
		string : str
			A string representing a gate.

	Returns
	----------
	Returns the parameter as a string if it is a variable, or as a float if it has a set value.
	"""
	string_patrameter = string.split("parameter=", 1)[1].split(")")[0]
	try:
		float_parameter = float(string_patrameter)
		return float_parameter
	except ValueError:
		return string_patrameter