



from doctest import testmod
from math import sqrt


def 						_UpperCAmelCase							( snake_case     ):





					"""simple docstring"""

					_lowerCAmelCase         =       []
					if num < 1:
										return facs
					facs.append(1     )
					if num == 1:
										return facs
					facs.append(snake_case     )
					for i in range(2      ,		int(sqrt(snake_case     )     ) + 1     ):
										if num % i == 0:  # If i is a factor of num
															facs.append(snake_case     )
															_lowerCAmelCase         =       num // i  # num//i is the other factor of num
															if d != i:  # If d and i are distinct
																				facs.append(snake_case     )  # we have found another factor
					facs.sort()
					return facs


if __name__ == "__main__":
	testmod(name="""factors_of_a_number""", verbose=True)





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


UpperCAmelCase__						:	str	     = logging.get_logger(__name__)

UpperCAmelCase__						:	int	     = {'vocab_file': 'vocab.json', 'merges_file': 'merges.txt', 'tokenizer_file': 'tokenizer.json'}

UpperCAmelCase__						:	int	     = {
    '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'
        ),
    },
}

UpperCAmelCase__						:	List[str]	     = {
    'microsoft/deberta-base': 512,
    'microsoft/deberta-large': 512,
    'microsoft/deberta-xlarge': 512,
    'microsoft/deberta-base-mnli': 512,
    'microsoft/deberta-large-mnli': 512,
    'microsoft/deberta-xlarge-mnli': 512,
}

UpperCAmelCase__						:	Optional[Any]	     = {
    'microsoft/deberta-base': {'do_lower_case': False},
    'microsoft/deberta-large': {'do_lower_case': False},
}






class UpperCAmelCase  (		SCREAMING_SNAKE_CASE__  ):





   '''simple docstring'''
   __UpperCamelCase						:       Union[str, Any]												=       VOCAB_FILES_NAMES
   __UpperCamelCase						:       Union[str, Any]												=       PRETRAINED_VOCAB_FILES_MAP
   __UpperCamelCase						:       Union[str, Any]												=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   __UpperCamelCase						:       str												=       ['''input_ids''', '''attention_mask''', '''token_type_ids''']
   __UpperCamelCase						:       Any												=       DebertaTokenizer


   def __init__(   self	:				Union[str, Any]     ,     lowerCAmelCase_	:				Optional[Any]=None     ,     lowerCAmelCase_	:				int=None     ,     lowerCAmelCase_	:				Dict=None     ,     lowerCAmelCase_	:				int="replace"     ,     lowerCAmelCase_	:				List[str]="[CLS]"     ,     lowerCAmelCase_	:				str="[SEP]"     ,     lowerCAmelCase_	:				int="[SEP]"     ,     lowerCAmelCase_	:				Any="[CLS]"     ,     lowerCAmelCase_	:				Dict="[UNK]"     ,     lowerCAmelCase_	:				Optional[int]="[PAD]"     ,     lowerCAmelCase_	:				List[str]="[MASK]"     ,     lowerCAmelCase_	:				Optional[Any]=False     ,     **lowerCAmelCase_	:				List[Any]     ,     ):

      """simple docstring"""
      super().__init__(
          lowerCAmelCase_     ,     lowerCAmelCase_     ,     tokenizer_file=lowerCAmelCase_     ,     errors=lowerCAmelCase_     ,     bos_token=lowerCAmelCase_     ,     eos_token=lowerCAmelCase_     ,     unk_token=lowerCAmelCase_     ,     sep_token=lowerCAmelCase_     ,     cls_token=lowerCAmelCase_     ,     pad_token=lowerCAmelCase_     ,     mask_token=lowerCAmelCase_     ,     add_prefix_space=lowerCAmelCase_     ,     **lowerCAmelCase_     ,     )
      _A:    List[str]						     =			kwargs.pop('''add_bos_token'''     ,     lowerCAmelCase_	)

      _A:    Optional[int]						     =			json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__()	)
      if pre_tok_state.get('''add_prefix_space'''     ,     lowerCAmelCase_	) != add_prefix_space:
         _A:    Dict						     =			getattr(lowerCAmelCase_     ,     pre_tok_state.pop('''type'''	)	)
         _A:    List[Any]						     =			add_prefix_space
         _A:    Optional[int]						     =			pre_tok_class(**lowerCAmelCase_	)

      _A:    Optional[Any]						     =			add_prefix_space


   @property
   def 					__magic_name__							(   self	:				Optional[Any]	):

      """simple docstring"""
      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 					__magic_name__							(   self	:				str     ,     lowerCAmelCase_	:				str	):

      """simple docstring"""
      _A:    Dict						     =			AddedToken(lowerCAmelCase_     ,     lstrip=lowerCAmelCase_     ,     rstrip=lowerCAmelCase_	) if isinstance(lowerCAmelCase_     ,     lowerCAmelCase_	) else value
      _A:    str						     =			value


   def 					__magic_name__							(   self	:				Optional[Any]     ,     lowerCAmelCase_	:				List[int]     ,     lowerCAmelCase_	:				Optional[List[int]] = None	):

      """simple docstring"""
      if token_ids_a is None:
         return [self.cls_token_id] + token_ids_a + [self.sep_token_id]
      _A:    str						     =			[self.cls_token_id]
      _A:    Any						     =			[self.sep_token_id]
      return cls + token_ids_a + sep + token_ids_a + sep


   def 					__magic_name__							(   self	:				Optional[int]     ,     lowerCAmelCase_	:				List[int]     ,     lowerCAmelCase_	:				Optional[List[int]] = None	):

      """simple docstring"""
      _A:    Dict						     =			[self.sep_token_id]
      _A:    Any						     =			[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 					__magic_name__							(   self	:				Tuple     ,     *lowerCAmelCase_	:				Dict     ,     **lowerCAmelCase_	:				Tuple	):

      """simple docstring"""
      _A:    Any						     =			kwargs.get('''is_split_into_words'''     ,     lowerCAmelCase_	)
      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(*lowerCAmelCase_     ,     **lowerCAmelCase_	)


   def 					__magic_name__							(   self	:				List[Any]     ,     *lowerCAmelCase_	:				Optional[Any]     ,     **lowerCAmelCase_	:				Any	):

      """simple docstring"""
      _A:    Optional[Any]						     =			kwargs.get('''is_split_into_words'''     ,     lowerCAmelCase_	)

      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(*lowerCAmelCase_     ,     **lowerCAmelCase_	)


   def 					__magic_name__							(   self	:				Optional[int]     ,     lowerCAmelCase_	:				str     ,     lowerCAmelCase_	:				Optional[str] = None	):

      """simple docstring"""
      _A:    Union[str, Any]						     =			self._tokenizer.model.save(lowerCAmelCase_     ,     name=lowerCAmelCase_	)
      return tuple(lowerCAmelCase_	)


   def 					__magic_name__							(   self	:				Union[str, Any]     ,     lowerCAmelCase_	:				"Conversation"	):

      """simple docstring"""
      _A:    List[Any]						     =			[]
      for is_user, text in conversation.iter_texts():
         input_ids.extend(self.encode(lowerCAmelCase_     ,     add_special_tokens=lowerCAmelCase_	) + [self.eos_token_id]	)

      if len(lowerCAmelCase_	) > self.model_max_length:
         _A:    Union[str, Any]						     =			input_ids[-self.model_max_length :]
      return input_ids



