


'''simple docstring'''



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

A__						:   List[Any]				=    6_3_7_8_1_3_7.0
A__						:   Any				=    6_3_5_6_7_5_2.3_1_4_2_4_5
A__						:   Optional[Any]				=    6378137



def      UpperCAmelCase__   (      UpperCAmelCase_       :							float ,       UpperCAmelCase_       :							float ,       UpperCAmelCase_       :							float ,       UpperCAmelCase_       :							float				)	->						float:
     __lowerCamelCase  :      Tuple														=						(AXIS_A - AXIS_B) / AXIS_A
     __lowerCamelCase  :      str														=						atan((1 - flattening) * tan(radians(UpperCAmelCase_				)				)				)
     __lowerCamelCase  :      Union[str, Any]														=						atan((1 - flattening) * tan(radians(UpperCAmelCase_				)				)				)
     __lowerCamelCase  :      Union[str, Any]														=						radians(UpperCAmelCase_				)
     __lowerCamelCase  :      str														=						radians(UpperCAmelCase_				)
     # Equation
     __lowerCamelCase  :      Union[str, Any]														=						sin((phi_a - phi_a) / 2				)
     __lowerCamelCase  :      int														=						sin((lambda_a - lambda_a) / 2				)
     # Square both values
     sin_sq_phi *= sin_sq_phi
     sin_sq_lambda *= sin_sq_lambda
     __lowerCamelCase  :      Any														=						sqrt(sin_sq_phi + (cos(UpperCAmelCase_				) * cos(UpperCAmelCase_				) * sin_sq_lambda)				)
     return 2 * RADIUS * asin(UpperCAmelCase_				)


if __name__ == "__main__":
      import doctest

      doctest.testmod()













import json
import os
import unittest

from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer

from ...test_tokenization_common import TokenizerTesterMixin




class        SCREAMING_SNAKE_CASE__					(		UpperCamelCase__							,   unittest.TestCase ):
 __SCREAMING_SNAKE_CASE							=      CTRLTokenizer
 __SCREAMING_SNAKE_CASE							=      False
 __SCREAMING_SNAKE_CASE							=      False



 def 							UpperCamelCase     (				self					):
        super().setUp()

        # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
        A__		   =		['''adapt''', '''re@@''', '''a@@''', '''apt''', '''c@@''', '''t''', '''<unk>''']
        A__		   =		dict(zip(__lowerCamelCase,range(len(__lowerCamelCase					)					)					)					)
        A__		   =		['''#version: 0.2''', '''a p''', '''ap t</w>''', '''r e''', '''a d''', '''ad apt</w>''', '''''']
        A__		   =		{'''unk_token''': '''<unk>'''}

        A__		   =		os.path.join(self.tmpdirname,VOCAB_FILES_NAMES['''vocab_file''']					)
        A__		   =		os.path.join(self.tmpdirname,VOCAB_FILES_NAMES['''merges_file''']					)
        with open(self.vocab_file,'''w''',encoding='''utf-8'''					) as fp:
               fp.write(json.dumps(__lowerCamelCase					) + '''\n'''					)
        with open(self.merges_file,'''w''',encoding='''utf-8'''					) as fp:
               fp.write('''\n'''.join(__lowerCamelCase					)					)



 def 							UpperCamelCase     (				self,**__lowerCamelCase					):
        kwargs.update(self.special_tokens_map					)
        return CTRLTokenizer.from_pretrained(self.tmpdirname,**__lowerCamelCase					)



 def 							UpperCamelCase     (				self,__lowerCamelCase					):
        A__		   =		'''adapt react readapt apt'''
        A__		   =		'''adapt react readapt apt'''
        return input_text, output_text




 def 							UpperCamelCase     (				self					):
        A__		   =		CTRLTokenizer(self.vocab_file,self.merges_file,**self.special_tokens_map					)
        A__		   =		'''adapt react readapt apt'''
        A__		   =		'''adapt re@@ a@@ c@@ t re@@ adapt apt'''.split()
        A__		   =		tokenizer.tokenize(__lowerCamelCase					)
        self.assertListEqual(__lowerCamelCase,__lowerCamelCase					)

        A__		   =		tokens + [tokenizer.unk_token]

        A__		   =		[0, 1, 2, 4, 5, 1, 0, 3, 6]
        self.assertListEqual(tokenizer.convert_tokens_to_ids(__lowerCamelCase					),__lowerCamelCase					)





