



import os
import unittest

from transformers import FunnelTokenizer, FunnelTokenizerFast
from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin







@require_tokenizers
class 	UpperCAmelCase	(		__a					,	unittest.TestCase):


 '''simple docstring'''




 __magic_name__					: int  =      FunnelTokenizer
 __magic_name__					: List[Any]  =      FunnelTokenizerFast
 __magic_name__					: List[str]  =      True
 __magic_name__					: int  =      True




 def       lowercase_  (   self) ->      int:



      """simple docstring"""







      super().setUp()

      a_       		=[
          "<unk>",
          "<cls>",
          "<sep>",
          "want",
          "##want",
          "##ed",
          "wa",
          "un",
          "runn",
          "##ing",
          ",",
          "low",
          "lowest",
      ]
      a_       		=os.path.join(self.tmpdirname							,  VOCAB_FILES_NAMES["vocab_file"])
      with open(self.vocab_file							,  "w"							,  encoding="utf-8") as vocab_writer:
           vocab_writer.write("".join([x + "\n" for x in vocab_tokens]))




 def       lowercase_  (   self							,  **lowerCAmelCase_) ->      List[str]:



      """simple docstring"""







      return FunnelTokenizer.from_pretrained(self.tmpdirname							,  **_UpperCAmelCase)




 def       lowercase_  (   self							,  **lowerCAmelCase_) ->      List[Any]:



      """simple docstring"""







      return FunnelTokenizerFast.from_pretrained(self.tmpdirname							,  **_UpperCAmelCase)




 def       lowercase_  (   self							,  lowerCAmelCase_) ->      Optional[Any]:



      """simple docstring"""







      a_       		="UNwant\u00E9d,running"
      a_       		="unwanted, running"
      return input_text, output_text




 def       lowercase_  (   self) ->      int:



      """simple docstring"""







      a_       		=self.tokenizer_class(self.vocab_file)

      a_       		=tokenizer.tokenize("UNwant\u00E9d,running")
      self.assertListEqual(_UpperCAmelCase							,  ["un", "##want", "##ed", ",", "runn", "##ing"])
      self.assertListEqual(tokenizer.convert_tokens_to_ids(_UpperCAmelCase)							,  [7, 4, 5, 1_0, 8, 9])




 def       lowercase_  (   self) ->      Any:



      """simple docstring"""







      a_       		=self.get_tokenizers(do_lower_case=_UpperCAmelCase)
      for tokenizer in tokenizers:
           a_       		=tokenizer("UNwant\u00E9d,running")
           a_       		=len(inputs["input_ids"]) - 1
           self.assertListEqual(inputs["token_type_ids"]							,  [2] + [0] * sentence_len)

           a_       		=tokenizer("UNwant\u00E9d,running"							,  "UNwant\u00E9d,running")
           self.assertListEqual(inputs["token_type_ids"]							,  [2] + [0] * sentence_len + [1] * sentence_len)







'''simple docstring'''


from __future__ import annotations






def  UpperCAmelCase_       (		lowercase__       ,	lowercase__       ):


     '''simple docstring'''







     if b == 0:
          return (1, 0)
     ((a_)		,						(a_))       		=extended_euclid(lowercase__       ,	a % b       )
     a_       		=a // b
     return (y, x - k * y)






def  UpperCAmelCase_       (		lowercase__       ,	lowercase__       ,	lowercase__       ,	lowercase__       ):


     '''simple docstring'''







     ((a_)		,						(a_))       		=extended_euclid(lowercase__       ,	lowercase__       )
     a_       		=na * na
     a_       		=ra * x * na + ra * y * na
     return (n % m + m) % m






def  UpperCAmelCase_       (		lowercase__       ,	lowercase__       ):


     '''simple docstring'''







     ((a_)		,						(a_))       		=extended_euclid(lowercase__       ,	lowercase__       )
     if b < 0:
          a_       		=(b % n + n) % n
     return b






def  UpperCAmelCase_       (		lowercase__       ,	lowercase__       ,	lowercase__       ,	lowercase__       ):


     '''simple docstring'''







     a_		,						a_       		=invert_modulo(lowercase__       ,	lowercase__       ), invert_modulo(lowercase__       ,	lowercase__       )
     a_       		=na * na
     a_       		=ra * x * na + ra * y * na
     return (n % m + m) % m


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

  testmod(name='''chinese_remainder_theorem''', verbose=True)
  testmod(name='''chinese_remainder_theorem2''', verbose=True)
  testmod(name='''invert_modulo''', verbose=True)
  testmod(name='''extended_euclid''', verbose=True)


