


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 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase		:							Union[str, Any]		 =						split_dict._to_yaml_list()
 assert len(SCREAMING_SNAKE_CASE__						) == len(SCREAMING_SNAKE_CASE__						)
 __lowerCamelCase		:							Optional[Any]		 =						SplitDict._from_yaml_list(SCREAMING_SNAKE_CASE__						)
 for split_name, split_info in split_dict.items():
  # dataset_name field is deprecated, and is therefore not part of the YAML dump
  __lowerCamelCase		:							Union[str, Any]		 =						None
  # the split name of split_dict takes over the name of the split info object
  __lowerCamelCase		:							List[str]		 =						split_name
 assert split_dict == reloaded



@pytest.mark.parametrize(
    'split_info'      ,	[SplitInfo(), SplitInfo(dataset_name=SCREAMING_SNAKE_CASE__						), SplitInfo(dataset_name='my_dataset'						)]						)
def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__						):
 # For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
 # field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
 __lowerCamelCase		:							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





from __future__ import annotations
def 				UpperCamelCase__					(  SCREAMING_SNAKE_CASE__						):
 __lowerCamelCase		:							List[Any]		 =						str(SCREAMING_SNAKE_CASE__						)
 return len(SCREAMING_SNAKE_CASE__						) == 9 and set(SCREAMING_SNAKE_CASE__						) == set('123456789'						)
def 				UpperCamelCase__					(  ):
 for base_num in range(9_999      ,	4_999      ,	-1						):
  __lowerCamelCase		:							Tuple		 =						100_002 * base_num
  if is_9_pandigital(SCREAMING_SNAKE_CASE__						):
   return candidate

 for base_num in range(333      ,	99      ,	-1						):
  __lowerCamelCase		:							Union[str, Any]		 =						1_002_003 * base_num
  if is_9_pandigital(SCREAMING_SNAKE_CASE__						):
   return candidate

 return None


if __name__ == "__main__":
       print(F"""{solution() = }""")

