



import unittest

from diffusers import __version__
from diffusers.utils import deprecate



class     __snake_case						(					unittest.TestCase						):
							_a      				=			'''.'''.join([str(int(__version__.split('''.'''						)[0]						) + 1						)] + __version__.split('''.'''						)[1:]						)
							_a      				=			'''0.0.1'''




							def        UpperCAmelCase__      (	self					:	Optional[int]):
									lowerCAmelCase_      :					Optional[int]     =			{'''deprecated_arg''': 4}

									with self.assertWarns(A_) as warning:
											lowerCAmelCase_      :					Any     =			deprecate('''deprecated_arg'''    ,    self.higher_version    ,    '''message'''    ,    take_from=A_)

									assert output == 4
									assert (
									    str(warning.warning)
									    == F"""The `deprecated_arg` argument is deprecated and will be removed in version {self.higher_version}."""
									    " message"
									)




							def        UpperCAmelCase__      (	self					:	Optional[int]):
									lowerCAmelCase_      :					Dict     =			{'''deprecated_arg''': 4}

									with self.assertWarns(A_) as warning:
											lowerCAmelCase_      :					int     =			deprecate(('''deprecated_arg''', self.higher_version, '''message''')    ,    take_from=A_)

									assert output == 4
									assert (
									    str(warning.warning)
									    == F"""The `deprecated_arg` argument is deprecated and will be removed in version {self.higher_version}."""
									    " message"
									)




							def        UpperCAmelCase__      (	self					:	Dict):
									lowerCAmelCase_      :					Union[str, Any]     =			{'''deprecated_arg_1''': 4, '''deprecated_arg_2''': 8}
									with self.assertWarns(A_) as warning:
											lowerCAmelCase_ ,  lowerCAmelCase_      :					Optional[Any]     =			deprecate(
											    ('''deprecated_arg_1''', self.higher_version, '''Hey''')    ,    ('''deprecated_arg_2''', self.higher_version, '''Hey''')    ,    take_from=A_    ,    )
									assert output_a == 4
									assert output_a == 8
									assert (
									    str(warning.warnings[0].message)
									    == "The `deprecated_arg_1` argument is deprecated and will be removed in version"
									    F""" {self.higher_version}. Hey"""
									)
									assert (
									    str(warning.warnings[1].message)
									    == "The `deprecated_arg_2` argument is deprecated and will be removed in version"
									    F""" {self.higher_version}. Hey"""
									)




							def        UpperCAmelCase__      (	self					:	Optional[Any]):
									lowerCAmelCase_      :					int     =			{'''deprecated_arg''': 4}

									with self.assertRaises(A_) as error:
											deprecate(('''wrong_arg''', self.higher_version, '''message''')    ,    take_from=A_)

									assert "test_deprecate_function_incorrect_arg in" in str(error.exception)
									assert "line" in str(error.exception)
									assert "got an unexpected keyword argument `deprecated_arg`" in str(error.exception)




							def        UpperCAmelCase__      (	self					:	Optional[Any]):
									with self.assertWarns(A_) as warning:
											deprecate(('''deprecated_arg''', self.higher_version, '''message'''))

									assert (
									    str(warning.warning)
									    == F"""`deprecated_arg` is deprecated and will be removed in version {self.higher_version}. message"""
									)




							def        UpperCAmelCase__      (	self					:	Union[str, Any]):
									with self.assertWarns(A_) as warning:
											deprecate(
											    ('''deprecated_arg_1''', self.higher_version, '''Hey''')    ,    ('''deprecated_arg_2''', self.higher_version, '''Hey''')    ,    )
									assert (
									    str(warning.warnings[0].message)
									    == F"""`deprecated_arg_1` is deprecated and will be removed in version {self.higher_version}. Hey"""
									)
									assert (
									    str(warning.warnings[1].message)
									    == F"""`deprecated_arg_2` is deprecated and will be removed in version {self.higher_version}. Hey"""
									)




							def        UpperCAmelCase__      (	self					:	str):



									class     __snake_case						:
																_a      				=			5

									with self.assertWarns(A_) as warning:
											lowerCAmelCase_      :					int     =			deprecate(('''arg''', self.higher_version, '''message''')    ,    take_from=Args())

									assert arg == 5
									assert (
									    str(warning.warning)
									    == F"""The `arg` attribute is deprecated and will be removed in version {self.higher_version}. message"""
									)




							def        UpperCAmelCase__      (	self					:	List[str]):



									class     __snake_case						:
																_a      				=			5
																_a      				=			7

									with self.assertWarns(A_) as warning:
											lowerCAmelCase_ ,  lowerCAmelCase_      :					Optional[int]     =			deprecate(
											    ('''arg''', self.higher_version, '''message''')    ,    ('''foo''', self.higher_version, '''message''')    ,    ('''does not exist''', self.higher_version, '''message''')    ,    take_from=Args()    ,    )

									assert arg_a == 5
									assert arg_a == 7
									assert (
									    str(warning.warning)
									    == F"""The `arg` attribute is deprecated and will be removed in version {self.higher_version}. message"""
									)
									assert (
									    str(warning.warnings[0].message)
									    == F"""The `arg` attribute is deprecated and will be removed in version {self.higher_version}. message"""
									)
									assert (
									    str(warning.warnings[1].message)
									    == F"""The `foo` attribute is deprecated and will be removed in version {self.higher_version}. message"""
									)




							def        UpperCAmelCase__      (	self					:	str):
									lowerCAmelCase_      :					int     =			{'''deprecated_arg''': 4}

									with self.assertRaises(A_) as error:
											deprecate(('''wrong_arg''', self.lower_version, '''message''')    ,    take_from=A_)

									assert (
									    str(error.exception)
									    == "The deprecation tuple ('wrong_arg', '0.0.1', 'message') should be removed since diffusers' version"
									    F""" {__version__} is >= {self.lower_version}"""
									)




							def        UpperCAmelCase__      (	self					:	Any):
									with self.assertWarns(A_) as warning:
											deprecate(('''deprecated_arg''', self.higher_version, '''This message is better!!!''')    ,    standard_warn=A_)

									assert str(warning.warning) == "This message is better!!!"







							def        UpperCAmelCase__      (	self					:	Union[str, Any]):
									with self.assertWarns(A_) as warning:
											deprecate(('''deprecated_arg''', self.higher_version, '''This message is better!!!''')    ,    standard_warn=A_)
									assert str(warning.warning) == "This message is better!!!"
									assert "diffusers/tests/others/test_utils.py" in warning.filename










from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
A__  :  Any       = 9.8_0_6_6_5


def       UpperCamelCase(  __UpperCamelCase							:		float					,__UpperCamelCase							:		float			):

		# Ensure valid instance
		if not isinstance(__UpperCamelCase					,(int, float)			):
				raise TypeError('''Invalid velocity. Should be a positive number.'''			)

		if not isinstance(__UpperCamelCase					,(int, float)			):
				raise TypeError('''Invalid angle. Range is 1-90 degrees.'''			)

		# Ensure valid angle
		if angle > 90 or angle < 1:
				raise ValueError('''Invalid angle. Range is 1-90 degrees.'''			)

		# Ensure valid velocity
		if init_velocity < 0:
				raise ValueError('''Invalid velocity. Should be a positive number.'''			)


def       UpperCamelCase(  __UpperCamelCase							:		float					,__UpperCamelCase							:		float			):
		check_args(__UpperCamelCase					,__UpperCamelCase			)
		lowerCAmelCase_      :					Optional[Any]     =			angle_to_radians(2 * angle			)
		return round(init_velocity**2 * sin(__UpperCamelCase			) / g					,2			)


def       UpperCamelCase(  __UpperCamelCase							:		float					,__UpperCamelCase							:		float			):
		check_args(__UpperCamelCase					,__UpperCamelCase			)
		lowerCAmelCase_      :					Any     =			angle_to_radians(__UpperCamelCase			)
		return round(init_velocity**2 * sin(__UpperCamelCase			) ** 2 / (2 * g)					,2			)


def       UpperCamelCase(  __UpperCamelCase							:		float					,__UpperCamelCase							:		float			):
		check_args(__UpperCamelCase					,__UpperCamelCase			)
		lowerCAmelCase_      :					Dict     =			angle_to_radians(__UpperCamelCase			)
		return round(2 * init_velocity * sin(__UpperCamelCase			) / g					,2			)


def       UpperCamelCase(  ):
		lowerCAmelCase_ ,  lowerCAmelCase_      :					Any     =			25, 20
		assert horizontal_distance(__UpperCamelCase					,__UpperCamelCase			) == 4_0.9_7
		assert max_height(__UpperCamelCase					,__UpperCamelCase			) == 3.7_3
		assert total_time(__UpperCamelCase					,__UpperCamelCase			) == 1.7_4


if __name__ == "__main__":
						from doctest import testmod

						testmod()

						# Get input from user
						A__  :  List[Any]       = float(input('''Initial Velocity: ''').strip())

						# Get input from user
						A__  :  Dict       = float(input('''angle: ''').strip())

						# Print results
						print()
						print('''Results: ''')
						print(F'''Horizontal Distance: {horizontal_distance(init_vel, angle)!s} [m]''')
						print(F'''Maximum Height: {max_height(init_vel, angle)!s} [m]''')
						print(F'''Total Time: {total_time(init_vel, angle)!s} [s]''')





