
from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

lowercase  :					Any													=       6_3_7_8_1_3_7.0
lowercase  :					Tuple													=       6_3_5_6_7_5_2.3_1_4_2_4_5
lowercase  :					str													=       6378137




def 	_SCREAMING_SNAKE_CASE					(		_lowerCamelCase :			float						,  _lowerCamelCase :			float						,  _lowerCamelCase :			float						,  _lowerCamelCase :			float)					->    float:






							'''simple docstring'''





							__UpperCamelCase	:   Tuple			   =					(AXIS_A - AXIS_B) / AXIS_A
							# Parametric latitudes
							# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
							__UpperCamelCase	:   Any			   =					atan((1 - flattening) * tan(radians(_lowerCamelCase)))
							__UpperCamelCase	:   List[Any]			   =					atan((1 - flattening) * tan(radians(_lowerCamelCase)))

							# Compute central angle between two points
							# using haversine theta. sigma =  haversine_distance / equatorial radius
							__UpperCamelCase	:   Union[str, Any]			   =					haversine_distance(_lowerCamelCase						,  _lowerCamelCase						,  _lowerCamelCase						,  _lowerCamelCase) / EQUATORIAL_RADIUS

							# Intermediate P and Q values
							__UpperCamelCase	:   Any			   =					(b_lata + b_lata) / 2
							__UpperCamelCase	:   Tuple			   =					(b_lata - b_lata) / 2

							# Intermediate X value
							# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
							__UpperCamelCase	:   Dict			   =					(sin(_lowerCamelCase) ** 2) * (cos(_lowerCamelCase) ** 2)
							__UpperCamelCase	:   Dict			   =					cos(sigma / 2) ** 2
							__UpperCamelCase	:   Optional[Any]			   =					(sigma - sin(_lowerCamelCase)) * (x_numerator / x_demonimator)

							# Intermediate Y value
							# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
							__UpperCamelCase	:   int			   =					(cos(_lowerCamelCase) ** 2) * (sin(_lowerCamelCase) ** 2)
							__UpperCamelCase	:   Optional[Any]			   =					sin(sigma / 2) ** 2
							__UpperCamelCase	:   str			   =					(sigma + sin(_lowerCamelCase)) * (y_numerator / y_denominator)

							return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
		import doctest

		doctest.testmod()

import unittest
from dataclasses import dataclass

import pytest

from accelerate.commands.config.config_args import SageMakerConfig
from accelerate.utils import ComputeEnvironment
from accelerate.utils.launch import _convert_nargs_to_dict




@dataclass
class  lowerCamelCase__							(				__lowercase):




	'''simple docstring'''




	_A								=     ComputeEnvironment.AMAZON_SAGEMAKER
	_A								=     True
	_A								=     'ml.p3.2xlarge'
	_A								=     'accelerate_sagemaker_execution_role'
	_A								=     'hf-sm'
	_A								=     'us-east-1'
	_A								=     1
	_A								=     'accelerate-sagemaker-1'
	_A								=     '1.6'
	_A								=     '4.4'
	_A								=     'train.py'
	_A								=     [
	    '--model_name_or_path',
	    'bert',
	    '--do_train',
	    'False',
	    '--epochs',
	    '3',
	    '--learning_rate',
	    '5e-5',
	    '--max_steps',
	    '50.5',
	]
	_A								=     [
	    '--model_name_or_path',
	    'bert',
	    '--do_train',
	    '--do_test',
	    'False',
	    '--do_predict',
	    '--epochs',
	    '3',
	    '--learning_rate',
	    '5e-5',
	    '--max_steps',
	    '50.5',
	]




class  lowerCamelCase__							(				unittest.TestCase):




	'''simple docstring'''




	def    _lowerCamelCase				(					self		:Any						)		-> Optional[int]:
								# If no defaults are changed, `to_kwargs` returns an empty dict.
								__UpperCamelCase	:   Optional[int]			   =					_convert_nargs_to_dict(MockLaunchConfig.success_training_script_args						)
								assert isinstance(converted_args["model_name_or_path"]     ,   a						)
								assert isinstance(converted_args["do_train"]     ,   a						)
								assert isinstance(converted_args["epochs"]     ,   a						)
								assert isinstance(converted_args["learning_rate"]     ,   a						)
								assert isinstance(converted_args["max_steps"]     ,   a						)

								with pytest.raises(a						):
															_convert_nargs_to_dict(MockLaunchConfig.fail_training_script_args						)