



"""simple docstring"""
from __future__ import annotations

from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass


@dataclass
class 							lowerCamelCase_:





					'''simple docstring'''



					lowercase__   :       int
					lowercase__   :       int


class 							lowerCamelCase_:





					'''simple docstring'''



					def __init__(    self				,       lowerCamelCase__   ):
									_lowerCamelCase        =				[[] for _ in range(lowerCamelCase__   )]
									_lowerCamelCase        =				size

					def __getitem__(    self				,       lowerCamelCase__   ):
									return iter(self._graph[vertex]   )

					@property
					def 			snake_case__      (    self   ):
									return self._size

					def 			snake_case__      (    self				,       lowerCamelCase__				,       lowerCamelCase__				,       lowerCamelCase__   ):
									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(lowerCamelCase__				,       lowerCamelCase__   )   )





					def 			snake_case__      (    self				,       lowerCamelCase__				,       lowerCamelCase__   ):
									_lowerCamelCase        =				deque([start_vertex]   )
									_lowerCamelCase        =				[None] * self.size
									_lowerCamelCase        =				0

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

													for edge in self[current_vertex]:
																	_lowerCamelCase        =				current_distance + edge.weight
																	_lowerCamelCase        =				distances[edge.destination_vertex]
																	if (
																	    isinstance(lowerCamelCase__				,       lowerCamelCase__   )
																	    and new_distance >= dest_vertex_distance
																	):
																					continue
																	_lowerCamelCase        =				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"""
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import sys
import warnings
from os.path import abspath, dirname, join


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
__SCREAMING_SNAKE_CASE  :						Optional[Any]    							=      abspath(join(dirname(dirname(__file__)), '''src'''))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action='''ignore''', category=FutureWarning)



def        lowerCAmelCase_(   lowercase_     :							List[Any]							)	->       Optional[Any]:
				from diffusers.utils.testing_utils import pytest_addoption_shared

				pytest_addoption_shared(lowercase_							)




def        lowerCAmelCase_(   lowercase_     :							List[str]							)	->       List[str]:
				from diffusers.utils.testing_utils import pytest_terminal_summary_main

				_lowerCamelCase        =				terminalreporter.config.getoption('''--make-reports'''							)
				if make_reports:
								pytest_terminal_summary_main(lowercase_						,   id=lowercase_							)
