


class       __magic_name__	:


					def __init__(      self							:     Optional[Any]			)  ->      Any:





						'''simple docstring'''






						UpperCamelCase__					:    List[str]          =   0
						UpperCamelCase__					:    int          =   0
						UpperCamelCase__					:    Optional[Any]          =   {}


					def      UpperCAmelCase__	(      self							:     str							,	lowerCamelCase__							:     int			)  ->      Optional[Any]:





						'''simple docstring'''






						if vertex not in self.adjacency:
							UpperCamelCase__					:    str          =   {}
							self.num_vertices += 1


					def      UpperCAmelCase__	(      self							:     int							,	lowerCamelCase__							:     Optional[Any]							,	lowerCamelCase__							:     Tuple							,	lowerCamelCase__							:     Dict			)  ->      str:





						'''simple docstring'''






						self.add_vertex(_snake_case			)
						self.add_vertex(_snake_case			)

						if head == tail:
							return

						UpperCamelCase__					:    Dict          =   weight
						UpperCamelCase__					:    Dict          =   weight


					def      UpperCAmelCase__	(      self							:     Optional[int]			)  ->      List[Any]:





						'''simple docstring'''






						UpperCamelCase__					:    str          =   self.get_edges()
						for edge in edges:
							UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    Dict          =   edge
							edges.remove((tail, head, weight)			)
						for i in range(len(_snake_case			)			):
							UpperCamelCase__					:    Union[str, Any]          =   list(edges[i]			)

						edges.sort(key=lambda lowerCamelCase__			: e[2]			)
						for i in range(len(_snake_case			) - 1			):
							if edges[i][2] >= edges[i + 1][2]:
								UpperCamelCase__					:    Optional[Any]          =   edges[i][2] + 1
						for edge in edges:
							UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    Union[str, Any]          =   edge
							UpperCamelCase__					:    Dict          =   weight
							UpperCamelCase__					:    str          =   weight


					def __str__(      self							:     int			)  ->      Union[str, Any]:





						'''simple docstring'''






						UpperCamelCase__					:    Tuple          =   ''''''
						for tail in self.adjacency:
							for head in self.adjacency[tail]:
								UpperCamelCase__					:    Any          =   self.adjacency[head][tail]
								string += F"{head} -> {tail} == {weight}\n"
						return string.rstrip('''\n'''			)


					def      UpperCAmelCase__	(      self							:     List[str]			)  ->      Dict:





						'''simple docstring'''






						UpperCamelCase__					:    Tuple          =   []
						for tail in self.adjacency:
							for head in self.adjacency[tail]:
								output.append((tail, head, self.adjacency[head][tail])			)
						return output


					def      UpperCAmelCase__	(      self							:     Optional[int]			)  ->      List[str]:





						'''simple docstring'''






						return self.adjacency.keys()


					@staticmethod
					def      UpperCAmelCase__	(      lowerCamelCase__							:     Any=None							,	lowerCamelCase__							:     List[Any]=None			)  ->      Optional[Any]:





						'''simple docstring'''






						UpperCamelCase__					:    Any          =   Graph()
						if vertices is None:
							UpperCamelCase__					:    Dict          =   []
						if edges is None:
							UpperCamelCase__					:    Tuple          =   []
						for vertex in vertices:
							g.add_vertex(_snake_case			)
						for edge in edges:
							g.add_edge(*_snake_case			)
						return g

					class       __magic_name__	:


										def __init__(      self							:     Any			)  ->      int:





											'''simple docstring'''






											UpperCamelCase__					:    Union[str, Any]          =   {}
											UpperCamelCase__					:    Optional[int]          =   {}


										def __len__(      self							:     Union[str, Any]			)  ->      List[str]:





											'''simple docstring'''






											return len(self.parent			)


										def      UpperCAmelCase__	(      self							:     Optional[int]							,	lowerCamelCase__							:     List[Any]			)  ->      Tuple:





											'''simple docstring'''






											if item in self.parent:
												return self.find(_snake_case			)

											UpperCamelCase__					:    Tuple          =   item
											UpperCamelCase__					:    int          =   0
											return item


										def      UpperCAmelCase__	(      self							:     List[str]							,	lowerCamelCase__							:     Tuple			)  ->      Optional[int]:





											'''simple docstring'''






											if item not in self.parent:
												return self.make_set(_snake_case			)
											if item != self.parent[item]:
												UpperCamelCase__					:    List[str]          =   self.find(self.parent[item]			)
											return self.parent[item]


										def      UpperCAmelCase__	(      self							:     Dict							,	lowerCamelCase__							:     Dict							,	lowerCamelCase__							:     List[Any]			)  ->      Dict:





											'''simple docstring'''






											UpperCamelCase__					:    str          =   self.find(_snake_case			)
											UpperCamelCase__					:    str          =   self.find(_snake_case			)

											if roota == roota:
												return roota

											if self.rank[roota] > self.rank[roota]:
												UpperCamelCase__					:    int          =   roota
												return roota

											if self.rank[roota] < self.rank[roota]:
												UpperCamelCase__					:    Optional[Any]          =   roota
												return roota

											if self.rank[roota] == self.rank[roota]:
												self.rank[roota] += 1
												UpperCamelCase__					:    Dict          =   roota
												return roota
											return None



					@staticmethod
					def      UpperCAmelCase__	(      lowerCamelCase__							:     List[Any]			)  ->      List[str]:





						'''simple docstring'''






						UpperCamelCase__					:    List[str]          =   graph.num_vertices

						UpperCamelCase__					:    Optional[Any]          =   Graph.UnionFind()
						UpperCamelCase__					:    Union[str, Any]          =   []
						while num_components > 1:
							UpperCamelCase__					:    List[Any]          =   {}
							for vertex in graph.get_vertices():
								UpperCamelCase__					:    List[str]          =   -1

							UpperCamelCase__					:    List[Any]          =   graph.get_edges()
							for edge in edges:
								UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    List[str]          =   edge
								edges.remove((tail, head, weight)			)
							for edge in edges:
								UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    List[Any]          =   edge
								UpperCamelCase__					:    Optional[int]          =   union_find.find(_snake_case			)
								UpperCamelCase__					:    Optional[Any]          =   union_find.find(_snake_case			)
								if seta != seta:
									if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
										UpperCamelCase__					:    List[Any]          =   [head, tail, weight]

									if cheap_edge[seta] == -1 or cheap_edge[seta][2] > weight:
										UpperCamelCase__					:    Any          =   [head, tail, weight]
							for vertex in cheap_edge:
								if cheap_edge[vertex] != -1:
									UpperCamelCase__       ,				UpperCamelCase__       ,				UpperCamelCase__					:    List[str]          =   cheap_edge[vertex]
									if union_find.find(_snake_case			) != union_find.find(_snake_case			):
										union_find.union(_snake_case							,	_snake_case			)
										mst_edges.append(cheap_edge[vertex]			)
										UpperCamelCase__					:    int          =   num_components - 1
						UpperCamelCase__					:    int          =   Graph.build(edges=_snake_case			)
						return mst






import contextlib
import importlib
import io
import unittest

import transformers

# Try to import everything from transformers to ensure every object can be loaded.
from transformers import *  # noqa F406
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch
from transformers.utils import ContextManagers, find_labels, is_flax_available, is_tf_available, is_torch_available


if is_torch_available():
       from transformers import BertForPreTraining, BertForQuestionAnswering, BertForSequenceClassification

if is_tf_available():
       from transformers import TFBertForPreTraining, TFBertForQuestionAnswering, TFBertForSequenceClassification

if is_flax_available():
       from transformers import FlaxBertForPreTraining, FlaxBertForQuestionAnswering, FlaxBertForSequenceClassification


__UpperCamelCase       :       Dict						       =				DUMMY_UNKNOWN_IDENTIFIER
# An actual model hosted on huggingface.co

__UpperCamelCase       :       Optional[int]						       =				"main"
# Default branch name
__UpperCamelCase       :       Optional[Any]						       =				"f2c752cfc5c0ab6f4bdec59acea69eefbee381c2"
# One particular commit (not the top of `main`)
__UpperCamelCase       :       str						       =				"aaaaaaa"
# This commit does not exist, so we should 404.

__UpperCamelCase       :       Optional[Any]						       =				"d9e9f15bc825e4b2c9249e9578f884bbcb5e3684"
# Sha-1 of config.json on the top of `main`, for checking purposes
__UpperCamelCase       :       Tuple						       =				"4b243c475af8d0a7754e87d7d096c92e5199ec2fe168a2ee7998e3b8e9bcb1d3"

@contextlib.contextmanager
def 			_a  (				):







 """simple docstring"""



 print('''Welcome!'''     )
 yield
 print('''Bye!'''     )

@contextlib.contextmanager
def 			_a  (				):







 """simple docstring"""



 print('''Bonjour!'''     )
 yield
 print('''Au revoir!'''     )

class       __magic_name__	(     unittest.TestCase):


     def      UpperCAmelCase__	(      self							:     Union[str, Any]			)  ->      Any:





      '''simple docstring'''






      assert transformers.__spec__ is not None
      assert importlib.util.find_spec('''transformers'''			) is not None



class       __magic_name__	(     unittest.TestCase):


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     Union[str, Any]							,	lowerCamelCase__							:     Union[str, Any]			)  ->      Optional[Any]:





      '''simple docstring'''






      with ContextManagers([]			):
       print('''Transformers are awesome!'''			)
      # The print statement adds a new line at the end of the output
      self.assertEqual(mock_stdout.getvalue()							,	'''Transformers are awesome!\n'''			)


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     Any							,	lowerCamelCase__							:     Union[str, Any]			)  ->      Dict:





      '''simple docstring'''






      with ContextManagers([context_en()]			):
       print('''Transformers are awesome!'''			)
      # The output should be wrapped with an English welcome and goodbye
      self.assertEqual(mock_stdout.getvalue()							,	'''Welcome!\nTransformers are awesome!\nBye!\n'''			)


     @unittest.mock.patch('''sys.stdout'''							,	new_callable=io.StringIO			)
     def      UpperCAmelCase__	(      self							:     List[Any]							,	lowerCamelCase__							:     List[str]			)  ->      Tuple:





      '''simple docstring'''






      with ContextManagers([context_fr(), context_en()]			):
       print('''Transformers are awesome!'''			)
      # The output should be wrapped with an English and French welcome and goodbye
      self.assertEqual(mock_stdout.getvalue()							,	'''Bonjour!\nWelcome!\nTransformers are awesome!\nBye!\nAu revoir!\n'''			)


     @require_torch
     def      UpperCAmelCase__	(      self							:     Tuple			)  ->      Optional[int]:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''', '''next_sentence_label''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''start_positions''', '''end_positions''']			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)


     @require_tf
     def      UpperCAmelCase__	(      self							:     Union[str, Any]			)  ->      Tuple:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''', '''next_sentence_label''']			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''start_positions''', '''end_positions''']			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	['''labels''']			)


     @require_flax
     def      UpperCAmelCase__	(      self							:     str			)  ->      Optional[Any]:





      '''simple docstring'''






      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)
      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)

      class       __magic_name__	(     __lowerCAmelCase):
           pass



      self.assertEqual(find_labels(lowerCamelCase__			)							,	[]			)


