


from __future__ import annotations

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







@dataclass
class 	__lowercase    :





							"""simple docstring"""







							_UpperCAmelCase      =						42
							_UpperCAmelCase      =						42







class 	__lowercase    :





							"""simple docstring"""







							def __init__(      self			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     list[list[Edge]]					=					[[] for _ in range(lowerCAmelCase__       )]
										SCREAMING_SNAKE_CASE_		:     List[str]					=					size






							def __getitem__(      self			,						lowerCAmelCase__       ):





										"""simple docstring"""




										return iter(self._graph[vertex]       )






							@property
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




										return self._size






							def 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										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 					UpperCamelCase__     (      self			,						lowerCAmelCase__			,						lowerCAmelCase__       ):





										"""simple docstring"""




										SCREAMING_SNAKE_CASE_		:     Any					=					deque([start_vertex]       )
										SCREAMING_SNAKE_CASE_		:     list[int | None]					=					[None] * self.size
										SCREAMING_SNAKE_CASE_		:     int					=					0

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

													for edge in self[current_vertex]:
																SCREAMING_SNAKE_CASE_		:     Dict					=					current_distance + edge.weight
																SCREAMING_SNAKE_CASE_		:     List[Any]					=					distances[edge.destination_vertex]
																if (
																    isinstance(lowerCAmelCase__			,						lowerCAmelCase__       )
																    and new_distance >= dest_vertex_distance
																):
																			continue
																SCREAMING_SNAKE_CASE_		:     Optional[int]					=					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 ...configuration_utils import PretrainedConfig
from ...utils import logging


_lowercase          =						logging.get_logger(__name__)

_lowercase          =						{
    """facebook/dpr-ctx_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-single-nq-base""": (
        """https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json"""
    ),
    """facebook/dpr-ctx_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-question_encoder-multiset-base""": (
        """https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json"""
    ),
    """facebook/dpr-reader-multiset-base""": (
        """https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json"""
    ),
}




class     UpperCAmelCase_	(						_SCREAMING_SNAKE_CASE					):






						'''simple docstring'''






						_lowercase						: str										=  '''dpr'''




						def __init__(   self       ,  _lowercase=30_522       ,  _lowercase=768       ,  _lowercase=12       ,  _lowercase=12       ,  _lowercase=3_072       ,  _lowercase="gelu"       ,  _lowercase=0.1       ,  _lowercase=0.1       ,  _lowercase=512       ,  _lowercase=2       ,  _lowercase=0.02       ,  _lowercase=1e-12       ,  _lowercase=0       ,  _lowercase="absolute"       ,  _lowercase = 0       ,  **_lowercase       ,  ):

												"""simple docstring"""



												super().__init__(pad_token_id=_lowercase       ,  **_lowercase )

												_lowerCAmelCase    		=					vocab_size
												_lowerCAmelCase    		=					hidden_size
												_lowerCAmelCase    		=					num_hidden_layers
												_lowerCAmelCase    		=					num_attention_heads
												_lowerCAmelCase    		=					hidden_act
												_lowerCAmelCase    		=					intermediate_size
												_lowerCAmelCase    		=					hidden_dropout_prob
												_lowerCAmelCase    		=					attention_probs_dropout_prob
												_lowerCAmelCase    		=					max_position_embeddings
												_lowerCAmelCase    		=					type_vocab_size
												_lowerCAmelCase    		=					initializer_range
												_lowerCAmelCase    		=					layer_norm_eps
												_lowerCAmelCase    		=					projection_dim
												_lowerCAmelCase    		=					position_embedding_type
