



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


snake_case    :						str  =						{
    "configuration_xlm_roberta_xl": [
        "XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "XLMRobertaXLConfig",
        "XLMRobertaXLOnnxConfig",
    ],
}

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  snake_case    :						Dict  =						[
      "XLM_ROBERTA_XL_PRETRAINED_MODEL_ARCHIVE_LIST",
      "XLMRobertaXLForCausalLM",
      "XLMRobertaXLForMaskedLM",
      "XLMRobertaXLForMultipleChoice",
      "XLMRobertaXLForQuestionAnswering",
      "XLMRobertaXLForSequenceClassification",
      "XLMRobertaXLForTokenClassification",
      "XLMRobertaXLModel",
      "XLMRobertaXLPreTrainedModel",
  ]

if TYPE_CHECKING:
  from .configuration_xlm_roberta_xl import (
      XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP,
      XLMRobertaXLConfig,
      XLMRobertaXLOnnxConfig,
  )

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_xlm_roberta_xl import (
        XLM_ROBERTA_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
        XLMRobertaXLForCausalLM,
        XLMRobertaXLForMaskedLM,
        XLMRobertaXLForMultipleChoice,
        XLMRobertaXLForQuestionAnswering,
        XLMRobertaXLForSequenceClassification,
        XLMRobertaXLForTokenClassification,
        XLMRobertaXLModel,
        XLMRobertaXLPreTrainedModel,
    )

else:
  import sys

  snake_case    :						List[str]  =						_LazyModule(__name__, globals()['__file__'], _import_structure)




from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset




class 							lowerCAmelCase__  (	UpperCamelCase						):







					def  _lowercase			(       self      :     List[Any]):
											return [
											    {"col_1": 3, "col_2": "a"},
											    {"col_1": 2, "col_2": "b"},
											    {"col_1": 1, "col_2": "c"},
											    {"col_1": 0, "col_2": "d"},
											]







					def  _lowercase			(       self      :     Tuple):
											A__	:							Any						    = {"col_1": [3, 2, 1, 0], "col_2": ["a", "b", "c", "d"]}
											return Dataset.from_dict(_A)







					def  _lowercase			(       self      :     Union[str, Any]):
											A__	:							str						    = self._create_example_records()
											A__	:							Dict						    = Dataset.from_list(_A)
											self.assertListEqual(dset.column_names			,		["col_1", "col_2"])
											for i, r in enumerate(_A):
																	self.assertDictEqual(_A			,		example_records[i])







					def  _lowercase			(       self      :     List[str]):
											A__	:							List[str]						    = self._create_example_records()
											A__	:							Any						    = Dataset.from_list(_A)
											A__	:							Optional[int]						    = Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]})
											self.assertEqual(dset.info			,		dset_from_dict.info)







					def  _lowercase			(       self      :     Any):  # checks what happens with missing columns
											A__	:							Dict						    = [{"col_1": 1}, {"col_2": "x"}]
											A__	:							Any						    = Dataset.from_list(_A)
											self.assertDictEqual(dset[0]			,		{"col_1": 1})
											self.assertDictEqual(dset[1]			,		{"col_1": None})  # NB: first record is used for columns







					def  _lowercase			(       self      :     str):  # checks if the type can be inferred from the second record
											A__	:							Dict						    = [{"col_1": []}, {"col_1": [1, 2]}]
											A__	:							Dict						    = Dataset.from_list(_A)
											self.assertEqual(dset.info.features["col_1"]			,		Sequence(Value("int64")))







					def  _lowercase			(       self      :     Union[str, Any]):
											A__	:							Dict						    = Dataset.from_list([])
											self.assertEqual(len(_A)			,		0)
											self.assertListEqual(dset.column_names			,		[])