





from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
@dataclass
class 			_lowercase						:
     _UpperCAmelCase										=					42
     _UpperCAmelCase										=					42




class 			_lowercase						:







     def __init__( self    ,   A__    ) ->	Union[str, Any]:
      snake_case				=			[[] for _ in range(A__    )]
      snake_case				=			size







     def __getitem__( self    ,   A__    ) ->	Iterator[Edge]:
      return iter(self._graph[vertex]    )







     @property
     def     UpperCamelCase			( self    ) ->	Union[str, Any]:
      return self._size







     def     UpperCamelCase			( self    ,   A__    ,   A__    ,   A__    ) ->	str:
      if weight not in (0, 1):
       raise ValueError('''Edge weight must be either 0 or 1.'''    )

      if to_vertex < 0 or to_vertex >= self.size:
       raise ValueError('''Vertex indexes must be in [0; size).'''    )

      self._graph[from_vertex].append(Edge(A__    ,   A__    )    )







     def     UpperCamelCase			( self    ,   A__    ,   A__    ) ->	int | None:
      snake_case				=			deque([start_vertex]    )
      snake_case				=			[None] * self.size
      snake_case				=			0

      while queue:
       snake_case				=			queue.popleft()
       snake_case				=			distances[current_vertex]
       if current_distance is None:
        continue

       for edge in self[current_vertex]:
        snake_case				=			current_distance + edge.weight
        snake_case				=			distances[edge.destination_vertex]
        if (
            isinstance(A__    ,   A__    )
            and new_distance >= dest_vertex_distance
        ):
         continue
        snake_case				=			new_distance
        if edge.weight == 0:
         queue.appendleft(edge.destination_vertex    )
        else:
         queue.append(edge.destination_vertex    )

      if distances[finish_vertex] is None:
       raise ValueError('''No path from start_vertex to finish_vertex.'''    )

      return distances[finish_vertex]


if __name__ == "__main__":
   import doctest

   doctest.testmod()








'''simple docstring'''







from ...processing_utils import ProcessorMixin
class 			_lowercase						(       __a					):
     _UpperCAmelCase										=					'''WhisperFeatureExtractor'''
     _UpperCAmelCase										=					'''WhisperTokenizer'''







     def __init__( self    ,   A__    ,   A__    ) ->	Optional[Any]:
      super().__init__(A__    ,   A__    )
      snake_case				=			self.feature_extractor
      snake_case				=			False







     def     UpperCamelCase			( self    ,   A__=None    ,   A__=None    ,   A__=True    ) ->	Union[str, Any]:
      return self.tokenizer.get_decoder_prompt_ids(task=A__    ,   language=A__    ,   no_timestamps=A__    )







     def __call__( self    ,   *A__    ,   **A__    ) ->	Dict:
      # For backward compatibility
      if self._in_target_context_manager:
       return self.current_processor(*A__    ,   **A__    )

      snake_case				=			kwargs.pop('''audio'''    ,   A__    )
      snake_case				=			kwargs.pop('''sampling_rate'''    ,   A__    )
      snake_case				=			kwargs.pop('''text'''    ,   A__    )
      if len(A__    ) > 0:
       snake_case				=			args[0]
       snake_case				=			args[1:]

      if audio is None and text is None:
       raise ValueError('''You need to specify either an `audio` or `text` input to process.'''    )

      if audio is not None:
       snake_case				=			self.feature_extractor(A__    ,   *A__    ,   sampling_rate=A__    ,   **A__    )
      if text is not None:
       snake_case				=			self.tokenizer(A__    ,   **A__    )

      if text is None:
       return inputs

      elif audio is None:
       return encodings
      else:
       snake_case				=			encodings['''input_ids''']
       return inputs







     def     UpperCamelCase			( self    ,   *A__    ,   **A__    ) ->	Optional[Any]:
      return self.tokenizer.batch_decode(*A__    ,   **A__    )







     def     UpperCamelCase			( self    ,   *A__    ,   **A__    ) ->	str:
      return self.tokenizer.decode(*A__    ,   **A__    )







     def     UpperCamelCase			( self    ,   A__    ,   A__="np"    ) ->	Optional[Any]:
      return self.tokenizer.get_prompt_ids(A__    ,   return_tensors=A__    )

