






'''simple docstring'''






import json
import os
import unittest

from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast
from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin




@require_tokenizers
class a_    (    __A		,      unittest.TestCase							):
   _snake_case        =							OpenAIGPTTokenizer
   _snake_case        =							OpenAIGPTTokenizerFast
   _snake_case        =							True
   _snake_case        =							False







   def     SCREAMING_SNAKE_CASE__					(self)			->      Optional[Any]:
      """simple docstring"""






      super().setUp()

      # Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
      __snake_case				:      int     							= [
          '''l''',
          '''o''',
          '''w''',
          '''e''',
          '''r''',
          '''s''',
          '''t''',
          '''i''',
          '''d''',
          '''n''',
          '''w</w>''',
          '''r</w>''',
          '''t</w>''',
          '''lo''',
          '''low''',
          '''er</w>''',
          '''low</w>''',
          '''lowest</w>''',
          '''newer</w>''',
          '''wider</w>''',
          '''<unk>''',
      ]
      __snake_case				:      List[str]     							= dict(zip(__a					,   range(len(__a))))
      __snake_case				:      int     							= ['''#version: 0.2''', '''l o''', '''lo w''', '''e r</w>''', '''''']

      __snake_case				:      Dict     							= os.path.join(self.tmpdirname					,   VOCAB_FILES_NAMES['vocab_file'])
      __snake_case				:      List[str]     							= os.path.join(self.tmpdirname					,   VOCAB_FILES_NAMES['merges_file'])
      with open(self.vocab_file					,   'w') as fp:
         fp.write(json.dumps(__a))
      with open(self.merges_file					,   'w') as fp:
         fp.write('\n'.join(__a))







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






      return "lower newer", "lower newer"







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






      __snake_case				:      str     							= OpenAIGPTTokenizer(self.vocab_file					,   self.merges_file)

      __snake_case				:      Any     							= '''lower'''
      __snake_case				:      Dict     							= ['''low''', '''er</w>''']
      __snake_case				:      int     							= tokenizer.tokenize(__a)
      self.assertListEqual(__a					,   __a)

      __snake_case				:      Any     							= tokens + ['''<unk>''']
      __snake_case				:      Tuple     							= [1_4, 1_5, 2_0]
      self.assertListEqual(tokenizer.convert_tokens_to_ids(__a)					,   __a)







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






      for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
         with self.subTest(F"""{tokenizer.__class__.__name__} ({pretrained_name})"""):
            __snake_case				:      List[Any]     							= self.rust_tokenizer_class.from_pretrained(__a					,   **__a)

            # Simple input
            __snake_case				:      str     							= '''This is a simple input'''
            __snake_case				:      int     							= ['''This is a simple input 1''', '''This is a simple input 2''']
            __snake_case				:      Optional[int]     							= ('''This is a simple input''', '''This is a pair''')
            __snake_case				:      List[str]     							= [
                ('''This is a simple input 1''', '''This is a simple input 2'''),
                ('''This is a simple pair 1''', '''This is a simple pair 2'''),
            ]

            # Simple input tests
            self.assertRaises(__a					,   tokenizer_r.encode					,   __a					,   max_length=__a					,   padding='max_length')

            # Simple input
            self.assertRaises(__a					,   tokenizer_r.encode_plus					,   __a					,   max_length=__a					,   padding='max_length')

            # Simple input
            self.assertRaises(
                __a					,   tokenizer_r.batch_encode_plus					,   __a					,   max_length=__a					,   padding='max_length'					,   )

            # Pair input
            self.assertRaises(__a					,   tokenizer_r.encode					,   __a					,   max_length=__a					,   padding='max_length')

            # Pair input
            self.assertRaises(__a					,   tokenizer_r.encode_plus					,   __a					,   max_length=__a					,   padding='max_length')

            # Pair input
            self.assertRaises(
                __a					,   tokenizer_r.batch_encode_plus					,   __a					,   max_length=__a					,   padding='max_length'					,   )







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






      pass




@require_ftfy
@require_spacy
@require_tokenizers
class a_    (    __A							):
   pass







'''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)