




from typing import TYPE_CHECKING

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


UpperCamelCase__    			=			{
    """configuration_swiftformer""": [
        """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """SwiftFormerConfig""",
        """SwiftFormerOnnxConfig""",
    ]
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					UpperCamelCase__    			=			[
					    """SWIFTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
					    """SwiftFormerForImageClassification""",
					    """SwiftFormerModel""",
					    """SwiftFormerPreTrainedModel""",
					]

if TYPE_CHECKING:
					from .configuration_swiftformer import (
					    SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    SwiftFormerConfig,
					    SwiftFormerOnnxConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_swiftformer import (
										    SWIFTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
										    SwiftFormerForImageClassification,
										    SwiftFormerModel,
										    SwiftFormerPreTrainedModel,
										)

else:
					import sys

					UpperCamelCase__    			=			_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]