



"""simple docstring"""
import os

import pytest

from datasets import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
)


_UpperCAmelCase     =			pytest.mark.integration





@pytest.mark.parametrize("""path"""							,			["""paws""", """csv"""] )
def      __magic_name__				(							lowercase							,			lowercase ):
   inspect_dataset(lowercase							,			lowercase )
   SCREAMING_SNAKE_CASE_: List[str]     			=path + """.py"""
   assert script_name in os.listdir(lowercase )
   assert "__pycache__" not in os.listdir(lowercase )





@pytest.mark.filterwarnings("""ignore:inspect_metric is deprecated:FutureWarning""" )
@pytest.mark.filterwarnings("""ignore:metric_module_factory is deprecated:FutureWarning""" )
@pytest.mark.parametrize("""path"""							,			["""accuracy"""] )
def      __magic_name__				(							lowercase							,			lowercase ):
   inspect_metric(lowercase							,			lowercase )
   SCREAMING_SNAKE_CASE_: str     			=path + """.py"""
   assert script_name in os.listdir(lowercase )
   assert "__pycache__" not in os.listdir(lowercase )





@pytest.mark.parametrize(
    """path, config_name, expected_splits"""							,			[
        ("""squad""", """plain_text""", ["""train""", """validation"""]),
        ("""dalle-mini/wit""", """dalle-mini--wit""", ["""train"""]),
        ("""paws""", """labeled_final""", ["""train""", """test""", """validation"""]),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase							,			lowercase ):
   SCREAMING_SNAKE_CASE_: Optional[Any]     			=get_dataset_config_info(lowercase							,			config_name=lowercase )
   assert info.config_name == config_name
   assert list(info.splits.keys() ) == expected_splits





@pytest.mark.parametrize(
    """path, config_name, expected_exception"""							,			[
        ("""paws""", None, ValueError),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase							,			lowercase ):
   with pytest.raises(lowercase ):
      get_dataset_config_info(lowercase							,			config_name=lowercase )





@pytest.mark.parametrize(
    """path, expected"""							,			[
        ("""squad""", """plain_text"""),
        ("""acronym_identification""", """default"""),
        ("""lhoestq/squad""", """plain_text"""),
        ("""lhoestq/test""", """default"""),
        ("""lhoestq/demo1""", """lhoestq--demo1"""),
        ("""dalle-mini/wit""", """dalle-mini--wit"""),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase ):
   SCREAMING_SNAKE_CASE_: Any     			=get_dataset_config_names(lowercase )
   assert expected in config_names





@pytest.mark.parametrize(
    """path, expected_configs, expected_splits_in_first_config"""							,			[
        ("""squad""", ["""plain_text"""], ["""train""", """validation"""]),
        ("""dalle-mini/wit""", ["""dalle-mini--wit"""], ["""train"""]),
        ("""paws""", ["""labeled_final""", """labeled_swap""", """unlabeled_final"""], ["""train""", """test""", """validation"""]),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase							,			lowercase ):
   SCREAMING_SNAKE_CASE_: List[Any]     			=get_dataset_infos(lowercase )
   assert list(infos.keys() ) == expected_configs
   SCREAMING_SNAKE_CASE_: Dict     			=expected_configs[0]
   assert expected_config in infos
   SCREAMING_SNAKE_CASE_: List[str]     			=infos[expected_config]
   assert info.config_name == expected_config
   assert list(info.splits.keys() ) == expected_splits_in_first_config





@pytest.mark.parametrize(
    """path, expected_config, expected_splits"""							,			[
        ("""squad""", """plain_text""", ["""train""", """validation"""]),
        ("""dalle-mini/wit""", """dalle-mini--wit""", ["""train"""]),
        ("""paws""", """labeled_final""", ["""train""", """test""", """validation"""]),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase							,			lowercase ):
   SCREAMING_SNAKE_CASE_: Optional[int]     			=get_dataset_infos(lowercase )
   assert expected_config in infos
   SCREAMING_SNAKE_CASE_: Optional[int]     			=infos[expected_config]
   assert info.config_name == expected_config
   assert list(info.splits.keys() ) == expected_splits





@pytest.mark.parametrize(
    """path, config_name, expected_exception"""							,			[
        ("""paws""", None, ValueError),
    ]							,			)
def      __magic_name__				(							lowercase							,			lowercase							,			lowercase ):
   with pytest.raises(lowercase ):
      get_dataset_split_names(lowercase							,			config_name=lowercase )








"""simple docstring"""
def      __magic_name__				(							lowercase ):
   if upper_limit < 0:
      raise ValueError("""Limit for the Catalan sequence must be ≥ 0""" )

   SCREAMING_SNAKE_CASE_: Tuple     			=[0] * (upper_limit + 1)

   # Base case: C(0) = C(1) = 1
   SCREAMING_SNAKE_CASE_: Any     			=1
   if upper_limit > 0:
      SCREAMING_SNAKE_CASE_: List[str]     			=1

   # Recurrence relation: C(i) = sum(C(j).C(i-j-1)), from j = 0 to i
   for i in range(2							,			upper_limit + 1 ):
      for j in range(lowercase ):
         catalan_list[i] += catalan_list[j] * catalan_list[i - j - 1]

   return catalan_list


if __name__ == "__main__":
   print("""\n********* Catalan Numbers Using Dynamic Programming ************\n""")
   print("""\n*** Enter -1 at any time to quit ***""")
   print("""\nEnter the upper limit (≥ 0) for the Catalan number sequence: """, end="""""")
   try:
      while True:
         _UpperCAmelCase     =			int(input().strip())
         if N < 0:
            print("""\n********* Goodbye!! ************""")
            break
         else:
            print(f"""The Catalan numbers from 0 through {N} are:""")
            print(catalan_numbers(N))
            print("""Try another upper limit for the sequence: """, end="""""")
   except (NameError, ValueError):
      print("""\n********* Invalid input, goodbye! ************\n""")

   import doctest

   doctest.testmod()



