






"""simple docstring"""



import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput

@dataclass
class 			a	(  a_      ):
    UpperCAmelCase_					:	float
    UpperCAmelCase_					:	Optional[float]      	=None
    UpperCAmelCase_					:	Optional[float]      	=None


class 			a	(  unittest.TestCase      ):







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0			)
      self.assertEqual(x.a				,						3_0			)
      self.assertIsNone(x.b			)
      self.assertIsNone(x.c			)
      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x.d







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0				,						b=1_0			)
      self.assertEqual(x[0]				,						3_0			)
      self.assertEqual(x[1]				,						1_0			)
      self.assertEqual(x[:2]				,						(3_0, 1_0)			)
      self.assertEqual(x[:]				,						(3_0, 1_0)			)

      lowercase				       =			ModelOutputTest(a=3_0				,						c=1_0			)
      self.assertEqual(x[0]				,						3_0			)
      self.assertEqual(x[1]				,						1_0			)
      self.assertEqual(x[:2]				,						(3_0, 1_0)			)
      self.assertEqual(x[:]				,						(3_0, 1_0)			)







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0				,						b=1_0			)
      self.assertEqual(x['a']				,						3_0			)
      self.assertEqual(x['b']				,						1_0			)
      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x['c']

      lowercase				       =			ModelOutputTest(a=3_0				,						c=1_0			)
      self.assertEqual(x['a']				,						3_0			)
      self.assertEqual(x['c']				,						1_0			)
      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x['b']







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0			)
      self.assertEqual(list(x.keys()			)				,						['a']			)
      self.assertEqual(list(x.values()			)				,						[3_0]			)
      self.assertEqual(list(x.items()			)				,						[('a', 3_0)]			)
      self.assertEqual(list(_lowerCamelCase			)				,						['a']			)

      lowercase				       =			ModelOutputTest(a=3_0				,						b=1_0			)
      self.assertEqual(list(x.keys()			)				,						['a', 'b']			)
      self.assertEqual(list(x.values()			)				,						[3_0, 1_0]			)
      self.assertEqual(list(x.items()			)				,						[('a', 3_0), ('b', 1_0)]			)
      self.assertEqual(list(_lowerCamelCase			)				,						['a', 'b']			)

      lowercase				       =			ModelOutputTest(a=3_0				,						c=1_0			)
      self.assertEqual(list(x.keys()			)				,						['a', 'c']			)
      self.assertEqual(list(x.values()			)				,						[3_0, 1_0]			)
      self.assertEqual(list(x.items()			)				,						[('a', 3_0), ('c', 1_0)]			)
      self.assertEqual(list(_lowerCamelCase			)				,						['a', 'c']			)

      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x.update({'d': 2_0}			)
      with self.assertRaises(_lowerCamelCase			):
        del x["a"]
      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x.pop('a'			)
      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			x.setdefault('d'				,						3_2			)







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0			)
      lowercase				       =			1_0
      self.assertEqual(x.a				,						1_0			)
      self.assertEqual(x['a']				,						1_0			)







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest(a=3_0			)
      lowercase				       =			1_0
      self.assertEqual(x.a				,						1_0			)
      self.assertEqual(x['a']				,						1_0			)







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest({'a': 3_0, 'b': 1_0}			)
      self.assertEqual(list(x.keys()			)				,						['a', 'b']			)
      self.assertEqual(x.a				,						3_0			)
      self.assertEqual(x.b				,						1_0			)







    def      UpperCamelCase_ (     self			):
      lowercase				       =			ModelOutputTest([('a', 3_0), ('b', 1_0)]			)
      self.assertEqual(list(x.keys()			)				,						['a', 'b']			)
      self.assertEqual(x.a				,						3_0			)
      self.assertEqual(x.b				,						1_0			)

      with self.assertRaises(_lowerCamelCase			):
        lowercase				       =			ModelOutputTest([('a', 3_0), (1_0, 1_0)]			)

      lowercase				       =			ModelOutputTest(a=(3_0, 3_0)			)
      self.assertEqual(list(x.keys()			)				,						['a']			)
      self.assertEqual(x.a				,						(3_0, 3_0)			)




from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


snake_case_      :					Any				      =     {
    'configuration_imagegpt': ['IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ImageGPTConfig', 'ImageGPTOnnxConfig']
}

try:
	if not is_vision_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	snake_case_      :					str				      =     ['ImageGPTFeatureExtractor']
	snake_case_      :					Optional[int]				      =     ['ImageGPTImageProcessor']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	snake_case_      :					List[str]				      =     [
	    'IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'ImageGPTForCausalImageModeling',
	    'ImageGPTForImageClassification',
	    'ImageGPTModel',
	    'ImageGPTPreTrainedModel',
	    'load_tf_weights_in_imagegpt',
	]


if TYPE_CHECKING:
	from .configuration_imagegpt import IMAGEGPT_PRETRAINED_CONFIG_ARCHIVE_MAP, ImageGPTConfig, ImageGPTOnnxConfig

	try:
		if not is_vision_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .feature_extraction_imagegpt import ImageGPTFeatureExtractor
		from .image_processing_imagegpt import ImageGPTImageProcessor

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_imagegpt import (
		    IMAGEGPT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    ImageGPTForCausalImageModeling,
		    ImageGPTForImageClassification,
		    ImageGPTModel,
		    ImageGPTPreTrainedModel,
		    load_tf_weights_in_imagegpt,
		)

else:
	import sys

	snake_case_      :					Dict				      =     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)
