
"""simple docstring"""





import importlib.metadata
import operator
import re
import sys
from typing import Optional

from packaging import version


UpperCamelCase_					:						Tuple				= {
    '''<''': operator.lt,
    '''<=''': operator.le,
    '''==''': operator.eq,
    '''!=''': operator.ne,
    '''>=''': operator.ge,
    '''>''': operator.gt,
}
def 							A_     (__a				,   __a				,   __a				,   __a				,   __a				,   __a				):

					'''simple docstring'''





					if got_ver is None or want_ver is None:
										raise ValueError(
										    f'Unable to compare versions for {requirement}: need={want_ver} found={got_ver}. This is unusual. Consider'
										    f' reinstalling {pkg}.'				)
					if not ops[op](version.parse(__a				)				,   version.parse(__a				)				):
										raise ImportError(
										    f'{requirement} is required for a normal functioning of this module, but found {pkg}=={got_ver}.{hint}'				)
def 							A_     (__a				,   __a = None				):

					'''simple docstring'''





					A_				 =						f'\n{hint}' if hint is not None else ""

					# non-versioned check
					if re.match(R"^[\w_\-\d]+$"				,   __a				):
										A_ ,    A_ ,    A_				 =						requirement, None, None
					else:
										A_				 =						re.findall(R"^([^!=<>\s]+)([\s!=<>]{1,2}.+)"				,   __a				)
										if not match:
															raise ValueError(
															    "requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23, but"
															    f' got {requirement}'				)
										A_ ,    A_				 =						match[0]
										A_				 =						want_full.split(","				)  # there could be multiple requirements
										A_				 =						{}
										for w in want_range:
															A_				 =						re.findall(R"^([\s!=<>]{1,2})(.+)"				,   __a				)
															if not match:
																				raise ValueError(
																				    "requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23,"
																				    f' but got {requirement}'				)
															A_ ,    A_				 =						match[0]
															A_				 =						want_ver
															if op not in ops:
																				raise ValueError(f'{requirement}: need one of {list(ops.keys()				)}, but got {op}'				)

    # special case
					if pkg == "python":
										A_				 =						".".join([str(__a				) for x in sys.version_info[:3]]				)
										for op, want_ver in wanted.items():
															_compare_versions(__a				,   __a				,   __a				,   __a				,   __a				,   __a				)
										return

					# check if any version is installed
					try:
										A_				 =						importlib.metadata.version(__a				)
					except importlib.metadata.PackageNotFoundError:
										raise importlib.metadata.PackageNotFoundError(
										    f'The \'{requirement}\' distribution was not found and is required by this application. {hint}'				)

					# check that the right version is installed if version number or a range was provided
					if want_ver is not None:
										for op, want_ver in wanted.items():
															_compare_versions(__a				,   __a				,   __a				,   __a				,   __a				,   __a				)




def 							A_     (__a				):

					'''simple docstring'''





					A_				 =						"Try: pip install transformers -U or pip install -e '.[dev]' if you're working with git main"
					return require_version(__a				,   __a				)






"""simple docstring"""





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

from .haversine_distance import haversine_distance

UpperCamelCase_					:						Tuple				= 637_8137.0
UpperCamelCase_					:						List[str]				= 635_6752.31_4245
UpperCamelCase_					:						Dict				= 637_8137
def 							A_     (__a				,   __a				,   __a				,   __a				):

					'''simple docstring'''





					A_				 =						(AXIS_A - AXIS_B) / AXIS_A
					# Parametric latitudes
					# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
					A_				 =						atan((1 - flattening) * tan(radians(__a				)				)				)
					A_				 =						atan((1 - flattening) * tan(radians(__a				)				)				)

					# Compute central angle between two points
					# using haversine theta. sigma =  haversine_distance / equatorial radius
					A_				 =						haversine_distance(__a				,   __a				,   __a				,   __a				) / EQUATORIAL_RADIUS

					# Intermediate P and Q values
					A_				 =						(b_lata + b_lata) / 2
					A_				 =						(b_lata - b_lata) / 2

					# Intermediate X value
					# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
					A_				 =						(sin(__a				) ** 2) * (cos(__a				) ** 2)
					A_				 =						cos(sigma / 2				) ** 2
					A_				 =						(sigma - sin(__a				)) * (x_numerator / x_demonimator)

					# Intermediate Y value
					# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
					A_				 =						(cos(__a				) ** 2) * (sin(__a				) ** 2)
					A_				 =						sin(sigma / 2				) ** 2
					A_				 =						(sigma + sin(__a				)) * (y_numerator / y_denominator)

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


if __name__ == "__main__":
		import doctest

		doctest.testmod()




