



'''simple docstring'''







import json
from typing import TYPE_CHECKING, List, Optional, Tuple

from tokenizers import pre_tokenizers

from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_deberta import DebertaTokenizer


if TYPE_CHECKING:
      from transformers.pipelines.conversational import Conversation


lowercase__     :  Any    					=			logging.get_logger(__name__)

lowercase__     :  Union[str, Any]    					=			{'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

lowercase__     :  List[Any]    					=			{
    'vocab_file': {
        'microsoft/deberta-base': 'https://huggingface.co/microsoft/deberta-base/resolve/main/vocab.json',
        'microsoft/deberta-large': 'https://huggingface.co/microsoft/deberta-large/resolve/main/vocab.json',
        'microsoft/deberta-xlarge': 'https://huggingface.co/microsoft/deberta-xlarge/resolve/main/vocab.json',
        'microsoft/deberta-base-mnli': 'https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/vocab.json',
        'microsoft/deberta-large-mnli': 'https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/vocab.json',
        'microsoft/deberta-xlarge-mnli': (
            'https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/vocab.json'
        ),
    },
    'merges_file': {
        'microsoft/deberta-base': 'https://huggingface.co/microsoft/deberta-base/resolve/main/merges.txt',
        'microsoft/deberta-large': 'https://huggingface.co/microsoft/deberta-large/resolve/main/merges.txt',
        'microsoft/deberta-xlarge': 'https://huggingface.co/microsoft/deberta-xlarge/resolve/main/merges.txt',
        'microsoft/deberta-base-mnli': 'https://huggingface.co/microsoft/deberta-base-mnli/resolve/main/merges.txt',
        'microsoft/deberta-large-mnli': 'https://huggingface.co/microsoft/deberta-large-mnli/resolve/main/merges.txt',
        'microsoft/deberta-xlarge-mnli': (
            'https://huggingface.co/microsoft/deberta-xlarge-mnli/resolve/main/merges.txt'
        ),
    },
}

lowercase__     :  Tuple    					=			{
    'microsoft/deberta-base': 5_12,
    'microsoft/deberta-large': 5_12,
    'microsoft/deberta-xlarge': 5_12,
    'microsoft/deberta-base-mnli': 5_12,
    'microsoft/deberta-large-mnli': 5_12,
    'microsoft/deberta-xlarge-mnli': 5_12,
}

lowercase__     :  Union[str, Any]    					=			{
    'microsoft/deberta-base': {'do_lower_case': False},
    'microsoft/deberta-large': {'do_lower_case': False},
}

class       lowerCamelCase_							(	lowerCAmelCase_  ):






   '''simple docstring'''

   A :     List[str]				=	VOCAB_FILES_NAMES
   A :     int				=	PRETRAINED_VOCAB_FILES_MAP
   A :     List[Any]				=	PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   A :     List[str]				=	["input_ids", "attention_mask", "token_type_ids"]
   A :     List[str]				=	DebertaTokenizer


   def __init__(  self     ,						__UpperCamelCase=None     ,						__UpperCamelCase=None     ,						__UpperCamelCase=None     ,						__UpperCamelCase="replace"     ,						__UpperCamelCase="[CLS]"     ,						__UpperCamelCase="[SEP]"     ,						__UpperCamelCase="[SEP]"     ,						__UpperCamelCase="[CLS]"     ,						__UpperCamelCase="[UNK]"     ,						__UpperCamelCase="[PAD]"     ,						__UpperCamelCase="[MASK]"     ,						__UpperCamelCase=False     ,						**__UpperCamelCase     ,						):
       super().__init__(
           __UpperCamelCase     ,						__UpperCamelCase     ,						tokenizer_file=__UpperCamelCase     ,						errors=__UpperCamelCase     ,						bos_token=__UpperCamelCase     ,						eos_token=__UpperCamelCase     ,						unk_token=__UpperCamelCase     ,						sep_token=__UpperCamelCase     ,						cls_token=__UpperCamelCase     ,						pad_token=__UpperCamelCase     ,						mask_token=__UpperCamelCase     ,						add_prefix_space=__UpperCamelCase     ,						**__UpperCamelCase     ,						)
       UpperCamelCase__      =			kwargs.pop("add_bos_token"     ,						__UpperCamelCase )

       UpperCamelCase__      =			json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__() )
       if pre_tok_state.get("add_prefix_space"     ,						__UpperCamelCase ) != add_prefix_space:
           UpperCamelCase__      =			getattr(__UpperCamelCase     ,						pre_tok_state.pop("type" ) )
           UpperCamelCase__      =			add_prefix_space
           UpperCamelCase__      =			pre_tok_class(**__UpperCamelCase )

       UpperCamelCase__      =			add_prefix_space


   @property
   def 	_UpperCamelCase       (  self ):
       if self._mask_token is None:
           if self.verbose:
               logger.error("Using mask_token, but it is not set yet." )
           return None
       return str(self._mask_token )


   @mask_token.setter
   def 	_UpperCamelCase       (  self     ,						__UpperCamelCase ):
       UpperCamelCase__      =			AddedToken(__UpperCamelCase     ,						lstrip=__UpperCamelCase     ,						rstrip=__UpperCamelCase ) if isinstance(__UpperCamelCase     ,						__UpperCamelCase ) else value
       UpperCamelCase__      =			value


   def 	_UpperCamelCase       (  self     ,						__UpperCamelCase     ,						__UpperCamelCase = None ):
       if token_ids_a is None:
           return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
       UpperCamelCase__      =			[self.cls_token_id]
       UpperCamelCase__      =			[self.sep_token_id]
       return cls + token_ids_a + sep + token_ids_a + sep


   def 	_UpperCamelCase       (  self     ,						__UpperCamelCase     ,						__UpperCamelCase = None ):
       UpperCamelCase__      =			[self.sep_token_id]
       UpperCamelCase__      =			[self.cls_token_id]

       if token_ids_a is None:
           return len(cls + token_ids_a + sep ) * [0]
       return len(cls + token_ids_a + sep ) * [0] + len(token_ids_a + sep ) * [1]


   def 	_UpperCamelCase       (  self     ,						*__UpperCamelCase     ,						**__UpperCamelCase ):
       UpperCamelCase__      =			kwargs.get("is_split_into_words"     ,						__UpperCamelCase )
       assert self.add_prefix_space or not is_split_into_words, (
           f'You need to instantiate {self.__class__.__name__} with add_prefix_space=True '
           "to use it with pretokenized inputs."
       )

       return super()._batch_encode_plus(*__UpperCamelCase     ,						**__UpperCamelCase )


   def 	_UpperCamelCase       (  self     ,						*__UpperCamelCase     ,						**__UpperCamelCase ):
       UpperCamelCase__      =			kwargs.get("is_split_into_words"     ,						__UpperCamelCase )

       assert self.add_prefix_space or not is_split_into_words, (
           f'You need to instantiate {self.__class__.__name__} with add_prefix_space=True '
           "to use it with pretokenized inputs."
       )

       return super()._encode_plus(*__UpperCamelCase     ,						**__UpperCamelCase )


   def 	_UpperCamelCase       (  self     ,						__UpperCamelCase     ,						__UpperCamelCase = None ):
       UpperCamelCase__      =			self._tokenizer.model.save(__UpperCamelCase     ,						name=__UpperCamelCase )
       return tuple(__UpperCamelCase )







   def 	_UpperCamelCase       (  self     ,						__UpperCamelCase ):
       UpperCamelCase__      =			[]
       for is_user, text in conversation.iter_texts():
           input_ids.extend(self.encode(__UpperCamelCase     ,						add_special_tokens=__UpperCamelCase ) + [self.eos_token_id] )

       if len(__UpperCamelCase ) > self.model_max_length:
           UpperCamelCase__      =			input_ids[-self.model_max_length :]
       return input_ids









'''simple docstring'''







from math import radians as angle_to_radians
from math import sin

# Acceleration Constant on Earth (unit m/s^2)
lowercase__     :  str    					=			9.8_0_6_6_5





def 						snake_case__ (lowerCAmelCase_					,  lowerCAmelCase_	):

    # Ensure valid instance
    if not isinstance(lowerCAmelCase_					,  (int, float)	):
        raise TypeError("Invalid velocity. Should be a positive number."	)

    if not isinstance(lowerCAmelCase_					,  (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 						snake_case__ (lowerCAmelCase_					,  lowerCAmelCase_	):
    check_args(lowerCAmelCase_					,  lowerCAmelCase_	)
    UpperCamelCase__      =			angle_to_radians(2 * angle	)
    return round(init_velocity**2 * sin(lowerCAmelCase_	) / g					,  2	)





def 						snake_case__ (lowerCAmelCase_					,  lowerCAmelCase_	):
    check_args(lowerCAmelCase_					,  lowerCAmelCase_	)
    UpperCamelCase__      =			angle_to_radians(lowerCAmelCase_	)
    return round(init_velocity**2 * sin(lowerCAmelCase_	) ** 2 / (2 * g)					,  2	)





def 						snake_case__ (lowerCAmelCase_					,  lowerCAmelCase_	):
    check_args(lowerCAmelCase_					,  lowerCAmelCase_	)
    UpperCamelCase__      =			angle_to_radians(lowerCAmelCase_	)
    return round(2 * init_velocity * sin(lowerCAmelCase_	) / g					,  2	)





def 						snake_case__ ():
    UpperCamelCase__    ,  UpperCamelCase__      =			25, 20
    assert horizontal_distance(lowerCAmelCase_					,  lowerCAmelCase_	) == 40.97
    assert max_height(lowerCAmelCase_					,  lowerCAmelCase_	) == 3.73
    assert total_time(lowerCAmelCase_					,  lowerCAmelCase_	) == 1.74


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

      testmod()

      # Get input from user
      lowercase__     :  Union[str, Any]    					=			float(input('Initial Velocity: ').strip())

      # Get input from user
      lowercase__     :  Any    					=			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]''')




