"""simple docstring"""






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_torch_available,
    is_vision_available,
)


__lowerCAmelCase    :       Optional[Any]					     ={"""configuration_deit""": ["""DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """DeiTConfig""", """DeiTOnnxConfig"""]}

try:
       if not is_vision_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase    :       List[Any]					     =["""DeiTFeatureExtractor"""]
       __lowerCAmelCase    :       Dict					     =["""DeiTImageProcessor"""]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase    :       int					     =[
           """DEIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """DeiTForImageClassification""",
           """DeiTForImageClassificationWithTeacher""",
           """DeiTForMaskedImageModeling""",
           """DeiTModel""",
           """DeiTPreTrainedModel""",
       ]

try:
       if not is_tf_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __lowerCAmelCase    :       Union[str, Any]					     =[
           """TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST""",
           """TFDeiTForImageClassification""",
           """TFDeiTForImageClassificationWithTeacher""",
           """TFDeiTForMaskedImageModeling""",
           """TFDeiTModel""",
           """TFDeiTPreTrainedModel""",
       ]


if TYPE_CHECKING:
       from .configuration_deit import DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP, DeiTConfig, DeiTOnnxConfig

       try:
              if not is_vision_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .feature_extraction_deit import DeiTFeatureExtractor
              from .image_processing_deit import DeiTImageProcessor

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_deit import (
                  DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  DeiTForImageClassification,
                  DeiTForImageClassificationWithTeacher,
                  DeiTForMaskedImageModeling,
                  DeiTModel,
                  DeiTPreTrainedModel,
              )

       try:
              if not is_tf_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_tf_deit import (
                  TF_DEIT_PRETRAINED_MODEL_ARCHIVE_LIST,
                  TFDeiTForImageClassification,
                  TFDeiTForImageClassificationWithTeacher,
                  TFDeiTForMaskedImageModeling,
                  TFDeiTModel,
                  TFDeiTPreTrainedModel,
              )


else:
       import sys

       __lowerCAmelCase    :       str					     =_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





class      A__							:






				def __init__(						self					:      Optional[Any]    ,     a					:      list   ):






							'''simple docstring'''







							lowerCAmelCase__      :      Dict         =		set_counts
							lowerCAmelCase__      :      str         =		max(a   )
							lowerCAmelCase__      :      Any         =		len(a   )
							lowerCAmelCase__      :      List[str]         =		[1] * num_sets
							lowerCAmelCase__      :      Dict         =		list(range(a   )   )






				def 							_lowerCamelCase		(						self					:      Dict    ,     a					:      int    ,     a					:      int   ):






							'''simple docstring'''







							lowerCAmelCase__      :      Optional[Any]         =		self.get_parent(a   )
							lowerCAmelCase__      :      Tuple         =		self.get_parent(a   )

							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]
										lowerCAmelCase__      :      Tuple         =		0
										lowerCAmelCase__      :      str         =		dst_parent
										if self.ranks[dst_parent] == self.ranks[src_parent]:
													self.ranks[dst_parent] += 1
										lowerCAmelCase__      :      List[Any]         =		self.set_counts[dst_parent]
							else:
										self.set_counts[src_parent] += self.set_counts[dst_parent]
										lowerCAmelCase__      :      Optional[int]         =		0
										lowerCAmelCase__      :      Tuple         =		src_parent
										lowerCAmelCase__      :      Optional[int]         =		self.set_counts[src_parent]

							lowerCAmelCase__      :      Optional[Any]         =		max(self.max_set    ,     a   )
							return True






				def 							_lowerCamelCase		(						self					:      Any    ,     a					:      int   ):






							'''simple docstring'''







							if self.parents[disj_set] == disj_set:
										return disj_set
							lowerCAmelCase__      :      Tuple         =		self.get_parent(self.parents[disj_set]   )
							return self.parents[disj_set]