





"""simple docstring"""
# Algorithm for the pigeonhole sorting





def      __lowerCamelCase   (							a_     :		str							)			->      Any:
      __SCREAMING_SNAKE_CASE   :Tuple						=  min(a_							)  # min() finds the minimum value
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  max(a_							)  # max() finds the maximum value

      __SCREAMING_SNAKE_CASE   :Dict						=  max_val - min_val + 1  # size is difference of max and min values plus one

      # list of pigeonholes of size equal to the variable size
      __SCREAMING_SNAKE_CASE   :Dict						=  [0] * size

      # Populate the pigeonholes.
      for x in a:
            assert isinstance(a_ ,   a_							), "integers only please"
            holes[x - min_val] += 1

      # Putting the elements back into the array in an order.
      __SCREAMING_SNAKE_CASE   :Dict						=  0
      for count in range(a_							):
            while holes[count] > 0:
                  holes[count] -= 1
                  __SCREAMING_SNAKE_CASE   :int						=  count + min_val
                  i += 1



def      __lowerCamelCase   (							)			->      Any:
      __SCREAMING_SNAKE_CASE   :Any						=  [8, 3, 2, 7, 4, 6, 8]
      pigeonhole_sort(a_							)
      print('''Sorted order is:''' ,   ''' '''.join(a_							)							)


if __name__ == "__main__":
  main()






"""simple docstring"""
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=13_37 ,   num_examples=42 ,   dataset_name='''my_dataset'''							)}							),
        SplitDict({'''train''': SplitInfo(name='''train''' ,   num_bytes=13_37 ,   num_examples=42							)}							),
        SplitDict({'''train''': SplitInfo()}							),
    ] ,   )
def      __lowerCamelCase   (							a_     :		SplitDict							)			->      Optional[int]:
      __SCREAMING_SNAKE_CASE   :Tuple						=  split_dict._to_yaml_list()
      assert len(a_							) == len(a_							)
      __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  SplitDict._from_yaml_list(a_							)
      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   :int						=  None
            # the split name of split_dict takes over the name of the split info object
            __SCREAMING_SNAKE_CASE   :Union[str, Any]						=  split_name
      assert split_dict == reloaded







@pytest.mark.parametrize(
    '''split_info''' ,   [SplitInfo(), SplitInfo(dataset_name=a_							), SplitInfo(dataset_name='''my_dataset'''							)]							)
def      __lowerCamelCase   (							a_     :		Dict							)			->      Any:
      # 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
      __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