


"""simple docstring"""






class 	lowerCamelCase__  :







					"""simple docstring"""


					def __init__(			self       :					List[str]    ):
												'''simple docstring'''






												__UpperCAmelCase  :		Tuple 				=   0
												__UpperCAmelCase  :		Optional[Any] 				=   0
												__UpperCAmelCase  :		Tuple 				=   {}






					def lowerCamelCase__				(			self       :					int					,			UpperCamelCase       :					Any    ):
												'''simple docstring'''






												if vertex not in self.adjacency:
																			__UpperCAmelCase  :		Any 				=   {}
																			self.num_vertices += 1






					def lowerCamelCase__				(			self       :					str					,			UpperCamelCase       :					Union[str, Any]					,			UpperCamelCase       :					str					,			UpperCamelCase       :					List[Any]    ):
												'''simple docstring'''






												self.add_vertex(lowerCAmelCase_    )
												self.add_vertex(lowerCAmelCase_    )

												if head == tail:
																			return

												__UpperCAmelCase  :		Optional[Any] 				=   weight
												__UpperCAmelCase  :		str 				=   weight






					def lowerCamelCase__				(			self       :					Optional[Any]    ):
												'''simple docstring'''






												__UpperCAmelCase  :		List[Any] 				=   self.get_edges()
												for edge in edges:
																			__UpperCAmelCase  :		List[Any] 				=   edge
																			edges.remove((tail, head, weight)    )
												for i in range(len(lowerCAmelCase_    )    ):
																			__UpperCAmelCase  :		int 				=   list(edges[i]    )

												edges.sort(key=lambda UpperCamelCase    : e[2]    )
												for i in range(len(lowerCAmelCase_    ) - 1    ):
																			if edges[i][2] >= edges[i + 1][2]:
																										__UpperCAmelCase  :		Any 				=   edges[i][2] + 1
												for edge in edges:
																			__UpperCAmelCase  :		Optional[int] 				=   edge
																			__UpperCAmelCase  :		Any 				=   weight
																			__UpperCAmelCase  :		Tuple 				=   weight






					def __str__(			self       :					Union[str, Any]    ):
												'''simple docstring'''






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






					def lowerCamelCase__				(			self       :					Optional[int]    ):
												'''simple docstring'''






												__UpperCAmelCase  :		Optional[int] 				=   []
												for tail in self.adjacency:
																			for head in self.adjacency[tail]:
																										output.append((tail, head, self.adjacency[head][tail])    )
												return output






					def lowerCamelCase__				(			self       :					Optional[Any]    ):
												'''simple docstring'''






												return self.adjacency.keys()






					@staticmethod
					def lowerCamelCase__				(			UpperCamelCase       :					str=None					,			UpperCamelCase       :					Union[str, Any]=None    ):
												'''simple docstring'''






												__UpperCAmelCase  :		Optional[int] 				=   Graph()
												if vertices is None:
																			__UpperCAmelCase  :		List[str] 				=   []
												if edges is None:
																			__UpperCAmelCase  :		Any 				=   []
												for vertex in vertices:
																			g.add_vertex(lowerCAmelCase_    )
												for edge in edges:
																			g.add_edge(*lowerCAmelCase_    )
												return g





					class 	lowerCamelCase__  :







										"""simple docstring"""


										def __init__(			self       :					List[str]    ):
																	'''simple docstring'''






																	__UpperCAmelCase  :		Union[str, Any] 				=   {}
																	__UpperCAmelCase  :		List[Any] 				=   {}






										def __len__(			self       :					Optional[Any]    ):
																	'''simple docstring'''






																	return len(self.parent    )






										def lowerCamelCase__				(			self       :					List[Any]					,			UpperCamelCase       :					List[str]    ):
																	'''simple docstring'''






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

																	__UpperCAmelCase  :		str 				=   item
																	__UpperCAmelCase  :		Optional[int] 				=   0
																	return item






										def lowerCamelCase__				(			self       :					Optional[int]					,			UpperCamelCase       :					Tuple    ):
																	'''simple docstring'''






																	if item not in self.parent:
																								return self.make_set(lowerCAmelCase_    )
																	if item != self.parent[item]:
																								__UpperCAmelCase  :		int 				=   self.find(self.parent[item]    )
																	return self.parent[item]






										def lowerCamelCase__				(			self       :					Union[str, Any]					,			UpperCamelCase       :					List[Any]					,			UpperCamelCase       :					List[str]    ):
																	'''simple docstring'''






																	__UpperCAmelCase  :		List[str] 				=   self.find(lowerCAmelCase_    )
																	__UpperCAmelCase  :		Union[str, Any] 				=   self.find(lowerCAmelCase_    )

																	if roota == roota:
																								return roota

																	if self.rank[roota] > self.rank[roota]:
																								__UpperCAmelCase  :		List[str] 				=   roota
																								return roota

																	if self.rank[roota] < self.rank[roota]:
																								__UpperCAmelCase  :		Optional[int] 				=   roota
																								return roota

																	if self.rank[roota] == self.rank[roota]:
																								self.rank[roota] += 1
																								__UpperCAmelCase  :		List[Any] 				=   roota
																								return roota
																	return None






					@staticmethod
					def lowerCamelCase__				(			UpperCamelCase       :					Union[str, Any]    ):
												'''simple docstring'''






												__UpperCAmelCase  :		List[Any] 				=   graph.num_vertices

												__UpperCAmelCase  :		Optional[Any] 				=   Graph.UnionFind()
												__UpperCAmelCase  :		Dict 				=   []
												while num_components > 1:
																			__UpperCAmelCase  :		Tuple 				=   {}
																			for vertex in graph.get_vertices():
																										__UpperCAmelCase  :		str 				=   -1

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

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








"""simple docstring"""
import functools
import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


lowerCAmelCase__    						=			threading.Lock()
lowerCAmelCase__    						=			None

lowerCAmelCase__    						=			{
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

lowerCAmelCase__    						=			logging.WARNING

lowerCAmelCase__    						=			True





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		int       		=    os.getenv('TRANSFORMERS_VERBOSITY',						lowerCamelCase       )
				if env_level_str:
								if env_level_str in log_levels:
												return log_levels[env_level_str]
								else:
												logging.getLogger().warning(
												    f"""Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, """
												    f"""has to be one of: { ", ".join(log_levels.keys()       ) }"""       )
				return _default_log_level





def 				lowercase__		(					):
				return __name__.split('.'       )[0]





def 				lowercase__		(					):
				return logging.getLogger(_get_library_name()       )





def 				lowercase__		(					):
				global _default_handler

				with _lock:
								if _default_handler:
												# This library has already configured the library root logger.
												return
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    logging.StreamHandler()  # Set sys.stderr as stream.
								_SCREAMING_SNAKE_CASE   :		Tuple       		=    sys.stderr.flush

								# Apply our default configuration to the library root logger.
								_SCREAMING_SNAKE_CASE   :		Union[str, Any]       		=    _get_library_root_logger()
								library_root_logger.addHandler(_default_handler       )
								library_root_logger.setLevel(_get_default_logging_level()       )
								_SCREAMING_SNAKE_CASE   :		int       		=    False





def 				lowercase__		(					):
				global _default_handler

				with _lock:
								if not _default_handler:
												return

								_SCREAMING_SNAKE_CASE   :		Any       		=    _get_library_root_logger()
								library_root_logger.removeHandler(_default_handler       )
								library_root_logger.setLevel(logging.NOTSET       )
								_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    None





def 				lowercase__		(					):
				return log_levels





def 				lowercase__		(					lowerCamelCase = None       ):

				if name is None:
								_SCREAMING_SNAKE_CASE   :		Tuple       		=    _get_library_name()

				_configure_library_root_logger()
				return logging.getLogger(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()
				return _get_library_root_logger().getEffectiveLevel()





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()
				_get_library_root_logger().setLevel(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				return set_verbosity(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()

				assert _default_handler is not None
				_get_library_root_logger().removeHandler(_default_handler       )





def 				lowercase__		(					):
				_configure_library_root_logger()

				assert _default_handler is not None
				_get_library_root_logger().addHandler(_default_handler       )





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()

				assert handler is not None
				_get_library_root_logger().addHandler(lowerCamelCase       )





def 				lowercase__		(					lowerCamelCase       ):
				_configure_library_root_logger()

				assert handler is not None and handler not in _get_library_root_logger().handlers
				_get_library_root_logger().removeHandler(lowerCamelCase       )





def 				lowercase__		(					):
				_configure_library_root_logger()
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    False





def 				lowercase__		(					):
				_configure_library_root_logger()
				_SCREAMING_SNAKE_CASE   :		int       		=    True





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		Any       		=    _get_library_root_logger().handlers

				for handler in handlers:
								_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'       )
								handler.setFormatter(lowerCamelCase       )





def 				lowercase__		(					):
				_SCREAMING_SNAKE_CASE   :		List[str]       		=    _get_library_root_logger().handlers

				for handler in handlers:
								handler.setFormatter(lowerCamelCase       )





def 				lowercase__		(					self,						*lowerCamelCase,						**lowerCamelCase       ):
				_SCREAMING_SNAKE_CASE   :		str       		=    os.getenv('TRANSFORMERS_NO_ADVISORY_WARNINGS',						lowerCamelCase       )
				if no_advisory_warnings:
								return
				self.warning(*lowerCamelCase,						**lowerCamelCase       )


lowerCAmelCase__    						=			warning_advice





@functools.lru_cache(lowerCamelCase       )
def 				lowercase__		(					self,						*lowerCamelCase,						**lowerCamelCase       ):
				self.warning(*lowerCamelCase,						**lowerCamelCase       )


lowerCAmelCase__    						=			warning_once


class _lowerCAmelCase						:







						def __init__(    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							Optional[int]:  # pylint: disable=unused-argument
										_SCREAMING_SNAKE_CASE   :		Tuple       		=    args[0] if args else None







						def __iter__(    self							)		->							Dict:
										return iter(self._iterator							)







						def __getattr__(    self   ,				lowerCAmelCase_							)		->							Tuple:

										def empty_fn(*lowerCAmelCase_   ,				**lowerCAmelCase_							):  # pylint: disable=unused-argument
														return

										return empty_fn







						def __enter__(    self							)		->							List[Any]:
										return self







						def __exit__(    self   ,				lowerCAmelCase_   ,				lowerCAmelCase_   ,				lowerCAmelCase_							)		->							Optional[Any]:
										return







class _lowerCAmelCase						:







						def __call__(    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							Optional[Any]:
										if _tqdm_active:
														return tqdm_lib.tqdm(*lowerCAmelCase_   ,				**lowerCAmelCase_							)
										else:
														return EmptyTqdm(*lowerCAmelCase_   ,				**lowerCAmelCase_							)







						def 			A      (    self   ,				*lowerCAmelCase_   ,				**lowerCAmelCase_							)		->							List[str]:
										_SCREAMING_SNAKE_CASE   :		Optional[int]       		=    None
										if _tqdm_active:
														return tqdm_lib.tqdm.set_lock(*lowerCAmelCase_   ,				**lowerCAmelCase_							)







						def 			A      (    self							)		->							Any:
										if _tqdm_active:
														return tqdm_lib.tqdm.get_lock()







lowerCAmelCase__    						=			_tqdm_cls()





def 				lowercase__		(					):
				global _tqdm_active
				return bool(_tqdm_active       )





def 				lowercase__		(					):
				global _tqdm_active
				_SCREAMING_SNAKE_CASE   :		int       		=    True
				hf_hub_utils.enable_progress_bars()






def 				lowercase__		(					):
				global _tqdm_active
				_SCREAMING_SNAKE_CASE   :		Optional[Any]       		=    False
				hf_hub_utils.disable_progress_bars()

