import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict
@pytest.mark.parametrize(
    '''split_dict'''		,  [
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train'''		,  num_bytes=1_337		,  num_examples=42		,  dataset_name='''my_dataset'''						)}						),
        SplitDict({'''train''': SplitInfo(name='''train'''		,  num_bytes=1_337		,  num_examples=42						)}						),
        SplitDict({'''train''': SplitInfo()}						),
    ]		,  )
def       A	(    _lowercase						):
						SCREAMING_SNAKE_CASE							:    Tuple							=							split_dict._to_yaml_list()
						assert len(__lowercase						) == len(__lowercase						)
						SCREAMING_SNAKE_CASE							:    List[str]							=							SplitDict._from_yaml_list(__lowercase						)
						for split_name, split_info in split_dict.items():
												# dataset_name field is deprecated, and is therefore not part of the YAML dump
												SCREAMING_SNAKE_CASE							:    str							=							None
												# the split name of split_dict takes over the name of the split info object
												SCREAMING_SNAKE_CASE							:    Any							=							split_name
						assert split_dict == reloaded



@pytest.mark.parametrize(
    '''split_info'''		,  [SplitInfo(), SplitInfo(dataset_name=__lowercase						), SplitInfo(dataset_name='''my_dataset'''						)]						)
def       A	(    _lowercase						):
						SCREAMING_SNAKE_CASE							:    Union[str, Any]							=							asdict(SplitDict({'''train''': split_info}						)						)
						assert "dataset_name" in split_dict_asdict["train"]
						assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name












'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a__							:							List[str] ={
    '''configuration_bigbird_pegasus''': [
        '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''BigBirdPegasusConfig''',
        '''BigBirdPegasusOnnxConfig''',
    ],
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    a__							:							Any =[
        '''BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST''',
        '''BigBirdPegasusForCausalLM''',
        '''BigBirdPegasusForConditionalGeneration''',
        '''BigBirdPegasusForQuestionAnswering''',
        '''BigBirdPegasusForSequenceClassification''',
        '''BigBirdPegasusModel''',
        '''BigBirdPegasusPreTrainedModel''',
    ]


if TYPE_CHECKING:
    from .configuration_bigbird_pegasus import (
        BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP,
        BigBirdPegasusConfig,
        BigBirdPegasusOnnxConfig,
    )

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_bigbird_pegasus import (
            BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
            BigBirdPegasusForCausalLM,
            BigBirdPegasusForConditionalGeneration,
            BigBirdPegasusForQuestionAnswering,
            BigBirdPegasusForSequenceClassification,
            BigBirdPegasusModel,
            BigBirdPegasusPreTrainedModel,
        )


else:
    import sys

    a__							:							str =_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
