
"""simple docstring"""


from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
__A					=			9.80_665



def        _lowerCamelCase(__UpperCamelCase       ,					__UpperCamelCase			)							->					None:

	# 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        _lowerCamelCase(__UpperCamelCase       ,					__UpperCamelCase			)							->					float:
	check_args(__UpperCamelCase       ,					__UpperCamelCase			)
	_lowerCAmelCase								=angle_to_radians(2 * angle			)
	return round(init_velocity**2 * sin(__UpperCamelCase			) / g       ,					2			)



def        _lowerCamelCase(__UpperCamelCase       ,					__UpperCamelCase			)							->					float:
	check_args(__UpperCamelCase       ,					__UpperCamelCase			)
	_lowerCAmelCase								=angle_to_radians(__UpperCamelCase			)
	return round(init_velocity**2 * sin(__UpperCamelCase			) ** 2 / (2 * g)       ,					2			)



def        _lowerCamelCase(__UpperCamelCase       ,					__UpperCamelCase			)							->					float:
	check_args(__UpperCamelCase       ,					__UpperCamelCase			)
	_lowerCAmelCase								=angle_to_radians(__UpperCamelCase			)
	return round(2 * init_velocity * sin(__UpperCamelCase			) / g       ,					2			)



def        _lowerCamelCase()							->					None:
	_lowerCAmelCase		,				_lowerCAmelCase								=25, 20
	assert horizontal_distance(__UpperCamelCase       ,					__UpperCamelCase			) == 40.97
	assert max_height(__UpperCamelCase       ,					__UpperCamelCase			) == 3.73
	assert total_time(__UpperCamelCase       ,					__UpperCamelCase			) == 1.74


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

			testmod()

			# Get input from user
			__A					=			float(input('Initial Velocity: ').strip())

			# Get input from user
			__A					=			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]""")





"""simple docstring"""


import os
import warnings
from pathlib import Path
from typing import Optional, Union

from .dynamic_module_utils import custom_object_save
from .tokenization_utils_base import PreTrainedTokenizerBase
from .utils import PushToHubMixin, copy_func, direct_transformers_import, logging


__A					=			logging.get_logger(__name__)

# Dynamically import the Transformers module to grab the attribute classes of the processor form their names.
__A					=			direct_transformers_import(Path(__file__).parent)


__A					=			{
    'AutoTokenizer': 'PreTrainedTokenizerBase',
    'AutoFeatureExtractor': 'FeatureExtractionMixin',
    'AutoImageProcessor': 'ImageProcessingMixin',
}







class 						lowerCamelCase__   (   __magic_name__							):





			'''simple docstring'''
			lowerCamelCase       =						['''feature_extractor''', '''tokenizer''']
			# Names need to be attr_class for attr in attributes
			lowerCamelCase       =						None
			lowerCamelCase       =						None
			lowerCamelCase       =						None



			def __init__(				self	,	*__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Dict:
				# Sanitize args and kwargs
				for key in kwargs:
					if key not in self.attributes:
						raise TypeError(f'''Unexpected keyword argument {key}.'''    )
				for arg, attribute_name in zip(__UpperCAmelCase	,	self.attributes    ):
					if attribute_name in kwargs:
						raise TypeError(f'''Got multiple values for argument {attribute_name}.'''    )
					else:
						_lowerCAmelCase								=arg

				if len(__UpperCAmelCase    ) != len(self.attributes    ):
					raise ValueError(
					    f'''This processor requires {len(self.attributes    )} arguments: {', '.join(self.attributes    )}. Got '''
					    f'''{len(__UpperCAmelCase    )} arguments instead.'''    )

				# Check each arg is of the proper class (this will also catch a user initializing in the wrong order)
				for attribute_name, arg in kwargs.items():
					_lowerCAmelCase								=getattr(self	,	f'''{attribute_name}_class'''    )
					# Nothing is ever going to be an instance of "AutoXxx", in that case we check the base class.
					_lowerCAmelCase								=AUTO_TO_BASE_CLASS_MAPPING.get(__UpperCAmelCase	,	__UpperCAmelCase    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) for n in class_name if n is not None    )
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						raise ValueError(
						    f'''Received a {type(__UpperCAmelCase    ).__name__} for argument {attribute_name}, but a {class_name} was expected.'''    )

					setattr(self	,	__UpperCAmelCase	,	__UpperCAmelCase    )



			def __repr__(				self    )					->	Optional[int]:
				_lowerCAmelCase								=[f'''- {name}: {repr(getattr(self	,	__UpperCAmelCase    )    )}''' for name in self.attributes]
				_lowerCAmelCase								="""\n""".join(__UpperCAmelCase    )
				return f'''{self.__class__.__name__}:\n{attributes_repr}'''



			def    _lowerCAmelCase						(				self	,	__UpperCAmelCase	,	__UpperCAmelCase = False	,	**__UpperCAmelCase    )					->	Union[str, Any]:
				os.makedirs(__UpperCAmelCase	,	exist_ok=__UpperCAmelCase    )

				if push_to_hub:
					_lowerCAmelCase								=kwargs.pop("""commit_message"""	,	__UpperCAmelCase    )
					_lowerCAmelCase								=kwargs.pop("""repo_id"""	,	save_directory.split(os.path.sep    )[-1]    )
					_lowerCAmelCase								=self._create_repo(__UpperCAmelCase	,	**__UpperCAmelCase    )
					_lowerCAmelCase								=self._get_files_timestamps(__UpperCAmelCase    )
				# If we have a custom config, we copy the file defining it in the folder and set the attributes so it can be
				# loaded from the Hub.
				if self._auto_class is not None:
					_lowerCAmelCase								=[getattr(self	,	__UpperCAmelCase    ) for attribute_name in self.attributes]
					_lowerCAmelCase								=[(a.init_kwargs if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ) else a) for a in attrs]
					custom_object_save(self	,	__UpperCAmelCase	,	config=__UpperCAmelCase    )

				for attribute_name in self.attributes:
					_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
					# Include the processor class in the attribute config so this processor can then be reloaded with the
					# `AutoProcessor` API.
					if hasattr(__UpperCAmelCase	,	"""_set_processor_class"""    ):
						attribute._set_processor_class(self.__class__.__name__    )
					attribute.save_pretrained(__UpperCAmelCase    )

				if self._auto_class is not None:
					# We added an attribute to the init_kwargs of the tokenizers, which needs to be cleaned up.
					for attribute_name in self.attributes:
						_lowerCAmelCase								=getattr(self	,	__UpperCAmelCase    )
						if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
							del attribute.init_kwargs["auto_map"]

				if push_to_hub:
					self._upload_modified_files(
					    __UpperCAmelCase	,	__UpperCAmelCase	,	__UpperCAmelCase	,	commit_message=__UpperCAmelCase	,	token=kwargs.get("""use_auth_token"""    )	,	)



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	__UpperCAmelCase = None	,	__UpperCAmelCase = False	,	__UpperCAmelCase = False	,	__UpperCAmelCase = None	,	__UpperCAmelCase = "main"	,	**__UpperCAmelCase	,	)					->	Any:
				_lowerCAmelCase								=cache_dir
				_lowerCAmelCase								=force_download
				_lowerCAmelCase								=local_files_only
				_lowerCAmelCase								=revision

				_lowerCAmelCase								=kwargs.pop("""use_auth_token"""	,	__UpperCAmelCase    )
				if use_auth_token is not None:
					warnings.warn(
					    """The `use_auth_token` argument is deprecated and will be removed in v5 of Transformers."""	,	__UpperCAmelCase    )
					if token is not None:
						raise ValueError(
						    """`token` and `use_auth_token` are both specified. Please set only the argument `token`."""    )
					_lowerCAmelCase								=use_auth_token

				if token is not None:
					# change to `token` in a follow-up PR
					_lowerCAmelCase								=token

				_lowerCAmelCase								=cls._get_arguments_from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )
				return cls(*__UpperCAmelCase    )



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase="AutoProcessor"    )					->	Optional[int]:
				if not isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
					_lowerCAmelCase								=auto_class.__name__

				import transformers.models.auto as auto_module

				if not hasattr(__UpperCAmelCase	,	__UpperCAmelCase    ):
					raise ValueError(f'''{auto_class} is not a valid auto class.'''    )

				_lowerCAmelCase								=auto_class



			@classmethod
			def    _lowerCAmelCase						(				cls	,	__UpperCAmelCase	,	**__UpperCAmelCase    )					->	Optional[Any]:
				_lowerCAmelCase								=[]
				for attribute_name in cls.attributes:
					_lowerCAmelCase								=getattr(cls	,	f'''{attribute_name}_class'''    )
					if isinstance(__UpperCAmelCase	,	__UpperCAmelCase    ):
						_lowerCAmelCase								=tuple(getattr(__UpperCAmelCase	,	__UpperCAmelCase    ) if n is not None else None for n in class_name    )
						_lowerCAmelCase								=kwargs.get("""use_fast"""	,	__UpperCAmelCase    )
						if use_fast and classes[1] is not None:
							_lowerCAmelCase								=classes[1]
						else:
							_lowerCAmelCase								=classes[0]
					else:
						_lowerCAmelCase								=getattr(__UpperCAmelCase	,	__UpperCAmelCase    )

					args.append(attribute_class.from_pretrained(__UpperCAmelCase	,	**__UpperCAmelCase    )    )
				return args



			@property
			def    _lowerCAmelCase						(				self    )					->	Optional[int]:
				_lowerCAmelCase								=getattr(self	,	self.attributes[0]    )
				return getattr(__UpperCAmelCase	,	"""model_input_names"""	,	__UpperCAmelCase    )







__A					=			copy_func(ProcessorMixin.push_to_hub)
if ProcessorMixin.push_to_hub.__doc__ is not None:
			__A					=			ProcessorMixin.push_to_hub.__doc__.format(
			    object='processor', object_class='AutoProcessor', object_files='processor files'
			)



