






'''simple docstring'''






import json
import os
import unittest

from transformers.models.blenderbot_small.tokenization_blenderbot_small import (
    VOCAB_FILES_NAMES,
    BlenderbotSmallTokenizer,
)

from ...test_tokenization_common import TokenizerTesterMixin




class a_    (    UpperCamelCase_		,      unittest.TestCase							):
   _snake_case        =							BlenderbotSmallTokenizer
   _snake_case        =							False







   def     SCREAMING_SNAKE_CASE__					(self)			->      List[str]:
      """simple docstring"""






      super().setUp()

      __snake_case				:      List[Any]     							= ['__start__', 'adapt', 'act', 'ap@@', 'te', '__end__', '__unk__']
      __snake_case				:      Optional[Any]     							= dict(zip(__a					,   range(len(__a))))

      __snake_case				:      List[str]     							= ['#version: 0.2', 'a p', 't e</w>', 'ap t</w>', 'a d', 'ad apt</w>', 'a c', 'ac t</w>', '']
      __snake_case				:      Optional[int]     							= {'unk_token': '__unk__', 'bos_token': '__start__', 'eos_token': '__end__'}

      __snake_case				:      Optional[Any]     							= os.path.join(self.tmpdirname					,   VOCAB_FILES_NAMES['vocab_file'])
      __snake_case				:      Dict     							= 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(__a) + '\n')
      with open(self.merges_file					,   'w'					,   encoding='utf-8') as fp:
         fp.write('\n'.join(__a))







   def     SCREAMING_SNAKE_CASE__					(self					,   **__a)			->      Tuple:
      """simple docstring"""






      kwargs.update(self.special_tokens_map)
      return BlenderbotSmallTokenizer.from_pretrained(self.tmpdirname					,   **__a)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a)			->      int:
      """simple docstring"""






      __snake_case				:      Optional[int]     							= 'adapt act apte'
      __snake_case				:      str     							= 'adapt act apte'
      return input_text, output_text







   def     SCREAMING_SNAKE_CASE__					(self)			->      Union[str, Any]:
      """simple docstring"""






      __snake_case				:      List[Any]     							= BlenderbotSmallTokenizer(self.vocab_file					,   self.merges_file					,   **self.special_tokens_map)
      __snake_case				:      Dict     							= 'adapt act apte'
      __snake_case				:      List[str]     							= ['adapt', 'act', 'ap@@', 'te']
      __snake_case				:      int     							= tokenizer.tokenize(__a)
      self.assertListEqual(__a					,   __a)

      __snake_case				:      Tuple     							= [tokenizer.bos_token] + tokens + [tokenizer.eos_token]

      __snake_case				:      str     							= [0, 1, 2, 3, 4, 5]
      self.assertListEqual(tokenizer.convert_tokens_to_ids(__a)					,   __a)







   def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
      """simple docstring"""






      __snake_case				:      Dict     							= BlenderbotSmallTokenizer.from_pretrained('facebook/blenderbot-90M')
      assert tok('sam').input_ids == [1_3_8_4]
      __snake_case				:      int     							= 'I am a small frog.'
      __snake_case				:      Optional[Any]     							= tok([src_text]					,   padding=__a					,   truncation=__a)['input_ids']
      __snake_case				:      int     							= tok.batch_decode(__a					,   skip_special_tokens=__a					,   clean_up_tokenization_spaces=__a)[0]
      assert src_text != decoded  # I wish it did!
      assert decoded == "i am a small frog ."







   def     SCREAMING_SNAKE_CASE__					(self)			->      Dict:
      """simple docstring"""






      __snake_case				:      Any     							= BlenderbotSmallTokenizer.from_pretrained('facebook/blenderbot-90M')
      __snake_case				:      str     							= 'I am a small frog .'
      __snake_case				:      Tuple     							= '.'
      __snake_case				:      int     							= tok(__a)['input_ids']
      __snake_case				:      Optional[Any]     							= tok(__a)['input_ids']

      assert encoded[-1] == encoded_dot[0]







'''simple docstring'''






import math




class a_    :







   def __init__(self					,   __a=0)			->      Any:  # a graph with Node 0,1,...,N-1
      """simple docstring"""






      __snake_case				:      List[str]     							= n
      __snake_case				:      Tuple     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # adjacency matrix for weight
      __snake_case				:      Union[str, Any]     							= [
          [math.inf for j in range(0					,   __a)] for i in range(0					,   __a)
      ]  # dp[i][j] stores minimum distance from i to j







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a					,   __a)			->      Tuple:
      """simple docstring"""






      __snake_case				:      Union[str, Any]     							= w







   def     SCREAMING_SNAKE_CASE__					(self)			->      Tuple:
      """simple docstring"""






      for k in range(0					,   self.n):
         for i in range(0					,   self.n):
            for j in range(0					,   self.n):
               __snake_case				:      List[Any]     							= min(self.dp[i][j]					,   self.dp[i][k] + self.dp[k][j])







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a)			->      Optional[int]:
      """simple docstring"""






      return self.dp[u][v]


if __name__ == "__main__":
      __A    	=   Graph(5)
      graph.add_edge(0, 2, 9)
      graph.add_edge(0, 4, 1_0)
      graph.add_edge(1, 3, 5)
      graph.add_edge(2, 3, 7)
      graph.add_edge(3, 0, 1_0)
      graph.add_edge(3, 1, 2)
      graph.add_edge(3, 2, 1)
      graph.add_edge(3, 4, 6)
      graph.add_edge(4, 1, 3)
      graph.add_edge(4, 2, 4)
      graph.add_edge(4, 3, 9)
      graph.floyd_warshall()
      graph.show_min(1, 4)
      graph.show_min(0, 3)