






'''simple docstring'''






class a_    :







   def __init__(self					,   __a)			->      List[Any]:
      """simple docstring"""






      __snake_case				:      Any     							= set_counts
      __snake_case				:      Optional[int]     							= max(UpperCAmelCase_)
      __snake_case				:      Optional[int]     							= len(UpperCAmelCase_)
      __snake_case				:      str     							= [1] * num_sets
      __snake_case				:      Optional[int]     							= list(range(UpperCAmelCase_))







   def     SCREAMING_SNAKE_CASE__					(self					,   __a					,   __a)			->      Optional[int]:
      """simple docstring"""






      __snake_case				:      int     							= self.get_parent(UpperCAmelCase_)
      __snake_case				:      List[str]     							= self.get_parent(UpperCAmelCase_)

      if src_parent == dst_parent:
         return False

      if self.ranks[dst_parent] >= self.ranks[src_parent]:
         self.set_counts[dst_parent] += self.set_counts[src_parent]
         __snake_case				:      Dict     							= 0
         __snake_case				:      Tuple     							= dst_parent
         if self.ranks[dst_parent] == self.ranks[src_parent]:
            self.ranks[dst_parent] += 1
         __snake_case				:      Dict     							= self.set_counts[dst_parent]
      else:
         self.set_counts[src_parent] += self.set_counts[dst_parent]
         __snake_case				:      Optional[Any]     							= 0
         __snake_case				:      int     							= src_parent
         __snake_case				:      str     							= self.set_counts[src_parent]

      __snake_case				:      str     							= max(self.max_set					,   UpperCAmelCase_)
      return True







   def     SCREAMING_SNAKE_CASE__					(self					,   __a)			->      List[str]:
      """simple docstring"""






      if self.parents[disj_set] == disj_set:
         return disj_set
      __snake_case				:      Any     							= self.get_parent(self.parents[disj_set])
      return self.parents[disj_set]







'''simple docstring'''






from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
      import accelerate




def        _SCREAMING_SNAKE_CASE  (				A  :       Optional[Any]  )    -> int:







   """simple docstring"""
   if not is_accelerate_available():
      return method
   __snake_case				:      Optional[Any]     							= version.parse(accelerate.__version__  ).base_version
   if version.parse(A  ) < version.parse('0.17.0'  ):
      return method

   def wrapper(self  :       Optional[Any]  ,		*A  :       Optional[Any]  ,		**A  :       Optional[int]  ):
      if hasattr(self  ,		'_hf_hook'  ) and hasattr(self._hf_hook  ,		'pre_forward'  ):
         self._hf_hook.pre_forward(self  )
      return method(self  ,		*A  ,		**A  )

   return wrapper