






'''simple docstring'''






import json
from typing import List, Optional, Tuple

from tokenizers import pre_tokenizers, processors

from ...tokenization_utils_base import AddedToken, BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_bart import BartTokenizer


__A    	=   logging.get_logger(__name__)


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

# See all BART models at https://huggingface.co/models?filter=bart
__A    	=   {
    'vocab_file': {
        'facebook/bart-base': 'https://huggingface.co/facebook/bart-base/resolve/main/vocab.json',
        'facebook/bart-large': 'https://huggingface.co/facebook/bart-large/resolve/main/vocab.json',
        'facebook/bart-large-mnli': 'https://huggingface.co/facebook/bart-large-mnli/resolve/main/vocab.json',
        'facebook/bart-large-cnn': 'https://huggingface.co/facebook/bart-large-cnn/resolve/main/vocab.json',
        'facebook/bart-large-xsum': 'https://huggingface.co/facebook/bart-large-xsum/resolve/main/vocab.json',
        'yjernite/bart_eli5': 'https://huggingface.co/yjernite/bart_eli5/resolve/main/vocab.json',
    },
    'merges_file': {
        'facebook/bart-base': 'https://huggingface.co/facebook/bart-base/resolve/main/merges.txt',
        'facebook/bart-large': 'https://huggingface.co/facebook/bart-large/resolve/main/merges.txt',
        'facebook/bart-large-mnli': 'https://huggingface.co/facebook/bart-large-mnli/resolve/main/merges.txt',
        'facebook/bart-large-cnn': 'https://huggingface.co/facebook/bart-large-cnn/resolve/main/merges.txt',
        'facebook/bart-large-xsum': 'https://huggingface.co/facebook/bart-large-xsum/resolve/main/merges.txt',
        'yjernite/bart_eli5': 'https://huggingface.co/yjernite/bart_eli5/resolve/main/merges.txt',
    },
    'tokenizer_file': {
        'facebook/bart-base': 'https://huggingface.co/facebook/bart-base/resolve/main/tokenizer.json',
        'facebook/bart-large': 'https://huggingface.co/facebook/bart-large/resolve/main/tokenizer.json',
        'facebook/bart-large-mnli': 'https://huggingface.co/facebook/bart-large-mnli/resolve/main/tokenizer.json',
        'facebook/bart-large-cnn': 'https://huggingface.co/facebook/bart-large-cnn/resolve/main/tokenizer.json',
        'facebook/bart-large-xsum': 'https://huggingface.co/facebook/bart-large-xsum/resolve/main/tokenizer.json',
        'yjernite/bart_eli5': 'https://huggingface.co/yjernite/bart_eli5/resolve/main/tokenizer.json',
    },
}

__A    	=   {
    'facebook/bart-base': 1_0_2_4,
    'facebook/bart-large': 1_0_2_4,
    'facebook/bart-large-mnli': 1_0_2_4,
    'facebook/bart-large-cnn': 1_0_2_4,
    'facebook/bart-large-xsum': 1_0_2_4,
    'yjernite/bart_eli5': 1_0_2_4,
}




class a_    (    lowerCAmelCase__							):
   _snake_case        =							VOCAB_FILES_NAMES
   _snake_case        =							PRETRAINED_VOCAB_FILES_MAP
   _snake_case        =							PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
   _snake_case        =							["input_ids", "attention_mask"]
   _snake_case        =							BartTokenizer







   def __init__(self					,   __a=None					,   __a=None					,   __a=None					,   __a="replace"					,   __a="<s>"					,   __a="</s>"					,   __a="</s>"					,   __a="<s>"					,   __a="<unk>"					,   __a="<pad>"					,   __a="<mask>"					,   __a=False					,   __a=True					,   **__a					,   )			->      Any:
      """simple docstring"""






      super().__init__(
          _SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE					,   tokenizer_file=_SCREAMING_SNAKE_CASE					,   errors=_SCREAMING_SNAKE_CASE					,   bos_token=_SCREAMING_SNAKE_CASE					,   eos_token=_SCREAMING_SNAKE_CASE					,   sep_token=_SCREAMING_SNAKE_CASE					,   cls_token=_SCREAMING_SNAKE_CASE					,   unk_token=_SCREAMING_SNAKE_CASE					,   pad_token=_SCREAMING_SNAKE_CASE					,   mask_token=_SCREAMING_SNAKE_CASE					,   add_prefix_space=_SCREAMING_SNAKE_CASE					,   trim_offsets=_SCREAMING_SNAKE_CASE					,   **_SCREAMING_SNAKE_CASE					,   )

      __snake_case				:      Optional[Any]     							= json.loads(self.backend_tokenizer.pre_tokenizer.__getstate__())
      if pre_tok_state.get('add_prefix_space'					,   _SCREAMING_SNAKE_CASE) != add_prefix_space:
         __snake_case				:      Union[str, Any]     							= getattr(_SCREAMING_SNAKE_CASE					,   pre_tok_state.pop('type'))
         __snake_case				:      Tuple     							= add_prefix_space
         __snake_case				:      List[str]     							= pre_tok_class(**_SCREAMING_SNAKE_CASE)

      __snake_case				:      Optional[Any]     							= add_prefix_space

      # the pre_tokenizer is already updated in the GPT2TokenizerFast `__init__`
      __snake_case				:      Union[str, Any]     							= 'post_processor'
      __snake_case				:      Union[str, Any]     							= getattr(self.backend_tokenizer					,   _SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE)
      if tokenizer_component_instance:
         __snake_case				:      Optional[Any]     							= json.loads(tokenizer_component_instance.__getstate__())

         # The lists 'sep' and 'cls' must be cased in tuples for the object `post_processor_class`
         if "sep" in state:
            __snake_case				:      Any     							= tuple(state['sep'])
         if "cls" in state:
            __snake_case				:      Any     							= tuple(state['cls'])

         __snake_case				:      List[Any]     							= False

         if state.get('add_prefix_space'					,   _SCREAMING_SNAKE_CASE) != add_prefix_space:
            __snake_case				:      int     							= add_prefix_space
            __snake_case				:      Dict     							= True

         if state.get('trim_offsets'					,   _SCREAMING_SNAKE_CASE) != trim_offsets:
            __snake_case				:      Dict     							= trim_offsets
            __snake_case				:      Any     							= True

         if changes_to_apply:
            __snake_case				:      Any     							= getattr(_SCREAMING_SNAKE_CASE					,   state.pop('type'))
            __snake_case				:      Optional[int]     							= component_class(**_SCREAMING_SNAKE_CASE)
            setattr(self.backend_tokenizer					,   _SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE)







   @property
   def     SCREAMING_SNAKE_CASE__					(self)			->      str:
      """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     SCREAMING_SNAKE_CASE__					(self					,   __a)			->      Tuple:
      """simple docstring"""






      __snake_case				:      List[str]     							= AddedToken(_SCREAMING_SNAKE_CASE					,   lstrip=_SCREAMING_SNAKE_CASE					,   rstrip=_SCREAMING_SNAKE_CASE) if isinstance(_SCREAMING_SNAKE_CASE					,   _SCREAMING_SNAKE_CASE) else value
      __snake_case				:      Tuple     							= value







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






      __snake_case				:      List[Any]     							= kwargs.get('is_split_into_words'					,   _SCREAMING_SNAKE_CASE)

      if is_split_into_words and not self.add_prefix_space:
         raise ValueError(
             F"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
             'to use it with pretokenized inputs.')

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







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






      __snake_case				:      List[str]     							= kwargs.get('is_split_into_words'					,   _SCREAMING_SNAKE_CASE)

      if is_split_into_words and not self.add_prefix_space:
         raise ValueError(
             F"""You need to instantiate {self.__class__.__name__} with add_prefix_space=True """
             'to use it with pretokenized inputs.')

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







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a = None)			->      Tuple[str]:
      """simple docstring"""






      __snake_case				:      str     							= self._tokenizer.model.save(_SCREAMING_SNAKE_CASE					,   name=_SCREAMING_SNAKE_CASE)
      return tuple(_SCREAMING_SNAKE_CASE)







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a=None)			->      str:
      """simple docstring"""






      __snake_case				:      List[Any]     							= [self.bos_token_id] + token_ids_a + [self.eos_token_id]
      if token_ids_a is None:
         return output

      return output + [self.eos_token_id] + token_ids_a + [self.eos_token_id]







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






      __snake_case				:      Dict     							= [self.sep_token_id]
      __snake_case				:      Optional[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 + sep + token_ids_a + sep) * [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)