
from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowercase__				:				List[Any]						=      9.80_665




def 						A_			(				snake_case				: Optional[Any]			,   snake_case				: Dict			)   ->     None:



						'''simple docstring'''

						if not isinstance(snake_case			,   (int, float)			):
												raise TypeError('''Invalid velocity. Should be a positive number.'''			)

						if not isinstance(snake_case			,   (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 						A_			(				snake_case				: Dict			,   snake_case				: List[Any]			)   ->     float:



						'''simple docstring'''

						check_args(snake_case			,   snake_case			)
						__UpperCamelCase  	=      angle_to_radians(2 * angle			)
						return round(init_velocity**2 * sin(snake_case			) / g			,   2			)




def 						A_			(				snake_case				: int			,   snake_case				: Union[str, Any]			)   ->     float:



						'''simple docstring'''

						check_args(snake_case			,   snake_case			)
						__UpperCamelCase  	=      angle_to_radians(snake_case			)
						return round(init_velocity**2 * sin(snake_case			) ** 2 / (2 * g)			,   2			)




def 						A_			(				snake_case				: Dict			,   snake_case				: Dict			)   ->     float:



						'''simple docstring'''

						check_args(snake_case			,   snake_case			)
						__UpperCamelCase  	=      angle_to_radians(snake_case			)
						return round(2 * init_velocity * sin(snake_case			) / g			,   2			)




def 						A_			(				)   ->     None:



						'''simple docstring'''

						__UpperCamelCase  	=      25, 20
						assert horizontal_distance(snake_case			,   snake_case			) == 40.97
						assert max_height(snake_case			,   snake_case			) == 3.73
						assert total_time(snake_case			,   snake_case			) == 1.74


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

				testmod()

				# Get input from user
				lowercase__				:				Optional[int]						=      float(input("Initial Velocity: ").strip())

				# Get input from user
				lowercase__				:				List[str]						=      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]")












import textwrap

import pyarrow as pa
import pytest

from datasets import Features, Image
from datasets.packaged_modules.text.text import Text

from ..utils import require_pil






@pytest.fixture
def    UpperCamelCase__  (   UpperCAmelCase     )     ->		Union[str, Any]:







							"""simple docstring"""





							_a  :    Tuple			=						tmp_path / '''text.txt'''
							_a  :    Dict			=						textwrap.dedent(
							    '''\
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
        Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

        Second paragraph:
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
        Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
        Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
        Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        '''     )
							with open(UpperCAmelCase    ,	'''w'''    ,	encoding='''utf-8'''     ) as f:
														f.write(UpperCAmelCase     )
							return str(UpperCAmelCase     )






@pytest.fixture
def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		Optional[int]:







							"""simple docstring"""





							_a  :    List[Any]			=						tmp_path / '''text_with_image.txt'''
							with open(UpperCAmelCase    ,	'''w'''    ,	encoding='''utf-8'''     ) as f:
														f.write(UpperCAmelCase     )
							return str(UpperCAmelCase     )






@pytest.mark.parametrize('''keep_linebreaks'''    ,	[True, False]     )
def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		Any:







							"""simple docstring"""





							with open(UpperCAmelCase    ,	encoding='''utf-8'''     ) as f:
														_a  :    str			=						f.read().splitlines(keepends=UpperCAmelCase     )
							_a  :    Tuple			=						Text(keep_linebreaks=UpperCAmelCase    ,	encoding='''utf-8'''     )
							_a  :    Optional[Any]			=						text._generate_tables([[text_file]]     )
							_a  :    str			=						pa.concat_tables([table for _, table in generator]     ).to_pydict()['''text''']
							assert generated_content == expected_content






@require_pil
def    UpperCamelCase__  (   UpperCAmelCase     )     ->		List[str]:







							"""simple docstring"""





							with open(UpperCAmelCase    ,	encoding='''utf-8'''     ) as f:
														_a  :    str			=						f.read().splitlines()[0]
							_a  :    Dict			=						Text(encoding='''utf-8'''    ,	features=Features({'''image''': Image()}     )     )
							_a  :    str			=						text._generate_tables([[text_file_with_image]]     )
							_a  :    int			=						pa.concat_tables([table for _, table in generator]     )
							assert pa_table.schema.field('''image'''     ).type == Image()()
							_a  :    Optional[int]			=						pa_table.to_pydict()['''image''']
							assert generated_content == [{"path": image_file, "bytes": None}]







@pytest.mark.parametrize('''sample_by'''    ,	['''line''', '''paragraph''', '''document''']     )
def    UpperCamelCase__  (   UpperCAmelCase    ,	UpperCAmelCase     )     ->		Optional[Any]:







							"""simple docstring"""





							with open(UpperCAmelCase    ,	encoding='''utf-8'''     ) as f:
														_a  :    Any			=						f.read()
							if sample_by == "line":
														_a  :    Any			=						expected_content.splitlines()
							elif sample_by == "paragraph":
														_a  :    Tuple			=						expected_content.split('''\n\n'''     )
							elif sample_by == "document":
														_a  :    Dict			=						[expected_content]
							_a  :    Dict			=						Text(sample_by=UpperCAmelCase    ,	encoding='''utf-8'''    ,	chunksize=100     )
							_a  :    Optional[int]			=						text._generate_tables([[text_file]]     )
							_a  :    List[Any]			=						pa.concat_tables([table for _, table in generator]     ).to_pydict()['''text''']
							assert generated_content == expected_content