



"""simple docstring"""






import unittest
from dataclasses import dataclass
from typing import Optional

from transformers.utils import ModelOutput

@dataclass
class 			__SCREAMING_SNAKE_CASE      ( lowerCAmelCase_  ):


					'''simple docstring'''





					_a       =				42
					_a       =				None
					_a       =				None





class 			__SCREAMING_SNAKE_CASE      ( unittest.TestCase  ):


					'''simple docstring'''





					def 						snake_case			(			self				:    Union[str, Any]	)->   Tuple:
								lowerCamelCase__						:						List[Any]						      =ModelOutputTest(a=30	)
								self.assertEqual(x.a,    30	)
								self.assertIsNone(x.b	)
								self.assertIsNone(x.c	)
								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						Dict						      =x.d



					def 						snake_case			(			self				:    Union[str, Any]	)->   int:
								lowerCamelCase__						:						List[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)	)

								lowerCamelCase__						:						Optional[Any]						      =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 						snake_case			(			self				:    str	)->   Tuple:
								lowerCamelCase__						:						Dict						      =ModelOutputTest(a=30,    b=10	)
								self.assertEqual(x['''a'''],    30	)
								self.assertEqual(x['''b'''],    10	)
								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						Dict						      =x["""c"""]

								lowerCamelCase__						:						int						      =ModelOutputTest(a=30,    c=10	)
								self.assertEqual(x['''a'''],    30	)
								self.assertEqual(x['''c'''],    10	)
								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						Union[str, Any]						      =x["""b"""]



					def 						snake_case			(			self				:    Any	)->   List[str]:
								lowerCamelCase__						:						Optional[Any]						      =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(UpperCAmelCase__	),    ['''a''']	)

								lowerCamelCase__						:						Optional[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(UpperCAmelCase__	),    ['''a''', '''b''']	)

								lowerCamelCase__						:						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(UpperCAmelCase__	),    ['''a''', '''c''']	)

								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						Tuple						      =x.update({'''d''': 20}	)
								with self.assertRaises(UpperCAmelCase__	):
											del x["a"]
								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						Optional[Any]						      =x.pop('''a'''	)
								with self.assertRaises(UpperCAmelCase__	):
											lowerCamelCase__						:						str						      =x.setdefault('''d''',    32	)



					def 						snake_case			(			self				:    int	)->   int:
								lowerCamelCase__						:						Union[str, Any]						      =ModelOutputTest(a=30	)
								lowerCamelCase__						:						Optional[int]						      =10
								self.assertEqual(x.a,    10	)
								self.assertEqual(x['''a'''],    10	)



					def 						snake_case			(			self				:    Dict	)->   int:
								lowerCamelCase__						:						int						      =ModelOutputTest(a=30	)
								lowerCamelCase__						:						int						      =10
								self.assertEqual(x.a,    10	)
								self.assertEqual(x['''a'''],    10	)



					def 						snake_case			(			self				:    Any	)->   int:
								lowerCamelCase__						:						List[Any]						      =ModelOutputTest({'''a''': 30, '''b''': 10}	)
								self.assertEqual(list(x.keys()	),    ['''a''', '''b''']	)
								self.assertEqual(x.a,    30	)
								self.assertEqual(x.b,    10	)




					def 						snake_case			(			self				:    List[Any]	)->   Optional[int]:
								lowerCamelCase__						:						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(UpperCAmelCase__	):
											lowerCamelCase__						:						Union[str, Any]						      =ModelOutputTest([('''a''', 30), (10, 10)]	)

								lowerCamelCase__						:						Dict						      =ModelOutputTest(a=(30, 30)	)
								self.assertEqual(list(x.keys()	),    ['''a''']	)
								self.assertEqual(x.a,    (30, 30)	)







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


UpperCAmelCase__			:  Optional[Any]					     =     {
    """configuration_musicgen""": [
        """MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """MusicgenConfig""",
        """MusicgenDecoderConfig""",
    ],
    """processing_musicgen""": ["""MusicgenProcessor"""],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__			:  Any					     =     [
      """MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """MusicgenForConditionalGeneration""",
      """MusicgenForCausalLM""",
      """MusicgenModel""",
      """MusicgenPreTrainedModel""",
  ]

if TYPE_CHECKING:
  from .configuration_musicgen import (
      MUSICGEN_PRETRAINED_CONFIG_ARCHIVE_MAP,
      MusicgenConfig,
      MusicgenDecoderConfig,
  )
  from .processing_musicgen import MusicgenProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_musicgen import (
        MUSICGEN_PRETRAINED_MODEL_ARCHIVE_LIST,
        MusicgenForCausalLM,
        MusicgenForConditionalGeneration,
        MusicgenModel,
        MusicgenPreTrainedModel,
    )

else:
  import sys

  UpperCAmelCase__			:  Dict					     =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




