



"""simple docstring"""






import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput

@dataclass
class 	__lowerCAmelCase							(UpperCAmelCase_  ):


					'''simple docstring'''


					a__        =     42
					a__        =     None
					a__        =     None



class 	__lowerCAmelCase							(unittest.TestCase  ):


					'''simple docstring'''


					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:List[Any]								=						ModelOutputTest(a=30   )
										self.assertEqual(x.a    ,       30   )
										self.assertIsNone(x.b   )
										self.assertIsNone(x.c   )
										with self.assertRaises(a   ):
															snake_case_						:Tuple								=						x.d







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:Union[str, Any]								=						ModelOutputTest(a=30    ,       b=10   )
										self.assertEqual(x[0]    ,       30   )
										self.assertEqual(x[1]    ,       10   )
										self.assertEqual(x[:2]    ,       (30, 10)   )
										self.assertEqual(x[:]    ,       (30, 10)   )

										snake_case_						:List[str]								=						ModelOutputTest(a=30    ,       c=10   )
										self.assertEqual(x[0]    ,       30   )
										self.assertEqual(x[1]    ,       10   )
										self.assertEqual(x[:2]    ,       (30, 10)   )
										self.assertEqual(x[:]    ,       (30, 10)   )







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:Union[str, Any]								=						ModelOutputTest(a=30    ,       b=10   )
										self.assertEqual(x["a"]    ,       30   )
										self.assertEqual(x["b"]    ,       10   )
										with self.assertRaises(a   ):
															snake_case_						:Tuple								=						x["c"]

										snake_case_						:Any								=						ModelOutputTest(a=30    ,       c=10   )
										self.assertEqual(x["a"]    ,       30   )
										self.assertEqual(x["c"]    ,       10   )
										with self.assertRaises(a   ):
															snake_case_						:Tuple								=						x["b"]







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:List[str]								=						ModelOutputTest(a=30   )
										self.assertEqual(list(x.keys()   )    ,       ["a"]   )
										self.assertEqual(list(x.values()   )    ,       [30]   )
										self.assertEqual(list(x.items()   )    ,       [("a", 30)]   )
										self.assertEqual(list(a   )    ,       ["a"]   )

										snake_case_						:List[Any]								=						ModelOutputTest(a=30    ,       b=10   )
										self.assertEqual(list(x.keys()   )    ,       ["a", "b"]   )
										self.assertEqual(list(x.values()   )    ,       [30, 10]   )
										self.assertEqual(list(x.items()   )    ,       [("a", 30), ("b", 10)]   )
										self.assertEqual(list(a   )    ,       ["a", "b"]   )

										snake_case_						:Optional[int]								=						ModelOutputTest(a=30    ,       c=10   )
										self.assertEqual(list(x.keys()   )    ,       ["a", "c"]   )
										self.assertEqual(list(x.values()   )    ,       [30, 10]   )
										self.assertEqual(list(x.items()   )    ,       [("a", 30), ("c", 10)]   )
										self.assertEqual(list(a   )    ,       ["a", "c"]   )

										with self.assertRaises(a   ):
															snake_case_						:Union[str, Any]								=						x.update({"d": 20}   )
										with self.assertRaises(a   ):
															del x["a"]
										with self.assertRaises(a   ):
															snake_case_						:Union[str, Any]								=						x.pop("a"   )
										with self.assertRaises(a   ):
															snake_case_						:int								=						x.setdefault("d"    ,       32   )







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:str								=						ModelOutputTest(a=30   )
										snake_case_						:Union[str, Any]								=						10
										self.assertEqual(x.a    ,       10   )
										self.assertEqual(x["a"]    ,       10   )







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:List[str]								=						ModelOutputTest(a=30   )
										snake_case_						:Optional[int]								=						10
										self.assertEqual(x.a    ,       10   )
										self.assertEqual(x["a"]    ,       10   )







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:Optional[Any]								=						ModelOutputTest({"a": 30, "b": 10}   )
										self.assertEqual(list(x.keys()   )    ,       ["a", "b"]   )
										self.assertEqual(x.a    ,       30   )
										self.assertEqual(x.b    ,       10   )







					def 		_a (      self   ):




										"""simple docstring"""





										snake_case_						:Union[str, Any]								=						ModelOutputTest([("a", 30), ("b", 10)]   )
										self.assertEqual(list(x.keys()   )    ,       ["a", "b"]   )
										self.assertEqual(x.a    ,       30   )
										self.assertEqual(x.b    ,       10   )

										with self.assertRaises(a   ):
															snake_case_						:Union[str, Any]								=						ModelOutputTest([("a", 30), (10, 10)]   )

										snake_case_						:Union[str, Any]								=						ModelOutputTest(a=(30, 30)   )
										self.assertEqual(list(x.keys()   )    ,       ["a"]   )
										self.assertEqual(x.a    ,       (30, 30)   )










"""simple docstring"""






from typing import TYPE_CHECKING

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


__UpperCAmelCase      :      Optional[int]   					=					{
    'configuration_segformer': ['SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SegformerConfig', 'SegformerOnnxConfig']
}

try:
				if not is_vision_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__UpperCAmelCase      :      int   					=					['SegformerFeatureExtractor']
				__UpperCAmelCase      :      Dict   					=					['SegformerImageProcessor']

try:
				if not is_torch_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__UpperCAmelCase      :      Optional[Any]   					=					[
				    'SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'SegformerDecodeHead',
				    'SegformerForImageClassification',
				    'SegformerForSemanticSegmentation',
				    'SegformerLayer',
				    'SegformerModel',
				    'SegformerPreTrainedModel',
				]

try:
				if not is_tf_available():
								raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
				pass
else:
				__UpperCAmelCase      :      Dict   					=					[
				    'TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST',
				    'TFSegformerDecodeHead',
				    'TFSegformerForImageClassification',
				    'TFSegformerForSemanticSegmentation',
				    'TFSegformerModel',
				    'TFSegformerPreTrainedModel',
				]


if TYPE_CHECKING:
				from .configuration_segformer import SEGFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, SegformerConfig, SegformerOnnxConfig

				try:
								if not is_vision_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .feature_extraction_segformer import SegformerFeatureExtractor
								from .image_processing_segformer import SegformerImageProcessor

				try:
								if not is_torch_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_segformer import (
								    SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    SegformerDecodeHead,
								    SegformerForImageClassification,
								    SegformerForSemanticSegmentation,
								    SegformerLayer,
								    SegformerModel,
								    SegformerPreTrainedModel,
								)
				try:
								if not is_tf_available():
												raise OptionalDependencyNotAvailable()
				except OptionalDependencyNotAvailable:
								pass
				else:
								from .modeling_tf_segformer import (
								    TF_SEGFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
								    TFSegformerDecodeHead,
								    TFSegformerForImageClassification,
								    TFSegformerForSemanticSegmentation,
								    TFSegformerModel,
								    TFSegformerPreTrainedModel,
								)

else:
				import sys

				__UpperCAmelCase      :      Optional[Any]   					=					_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)

