



'''simple docstring'''

import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows







def a_     (    __UpperCAmelCase					)				->					Dict:  # picklable for multiprocessing





			"""simple docstring"""







			return i + 1







@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def a_     (    )				->					Dict:





			"""simple docstring"""







			with parallel_backend('spark'					):
						assert ParallelBackendConfig.backend_name == "spark"

			snake_case:    Optional[int]      							=[1, 2, 3]
			with pytest.raises(_UpperCAmelCase					):
						with parallel_backend('unsupported backend'					):
									map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=2					)

			with pytest.raises(_UpperCAmelCase					):
						with parallel_backend('unsupported backend'					):
									map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=-1					)







@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize('num_proc'				,							[2, -1]					)
def a_     (    __UpperCAmelCase					)				->					List[Any]:





			"""simple docstring"""







			snake_case:    Dict      							=[1, 2]
			snake_case:    Optional[int]      							={'a': 1, 'b': 2}
			snake_case:    Dict      							={'a': [1, 2], 'b': [3, 4]}
			snake_case:    Any      							={'a': {'1': 1}, 'b': 2}
			snake_case:    Tuple      							={'a': 1, 'b': 2, 'c': 3, 'd': 4}
			snake_case:    List[str]      							=[2, 3]
			snake_case:    Dict      							={'a': 2, 'b': 3}
			snake_case:    Tuple      							={'a': [2, 3], 'b': [4, 5]}
			snake_case:    List[Any]      							={'a': {'1': 2}, 'b': 3}
			snake_case:    Optional[int]      							={'a': 2, 'b': 3, 'c': 4, 'd': 5}

			with parallel_backend('spark'					):
						assert map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=_UpperCAmelCase					) == expected_map_nested_sa
						assert map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=_UpperCAmelCase					) == expected_map_nested_sa
						assert map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=_UpperCAmelCase					) == expected_map_nested_sa
						assert map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=_UpperCAmelCase					) == expected_map_nested_sa
						assert map_nested(_UpperCAmelCase				,							_UpperCAmelCase				,							num_proc=_UpperCAmelCase					) == expected_map_nested_sa









'''simple docstring'''





from abc import ABC, abstractmethod
from argparse import ArgumentParser



class  snake_case__						(    SCREAMING_SNAKE_CASE_				):
 @staticmethod
 @abstractmethod
 def A_   (   __a						:							ArgumentParser  )      ->   List[str]:







       '''simple docstring'''
       raise NotImplementedError()





 @abstractmethod
 def A_   (   self						:							Optional[Any]  )      ->   Optional[Any]:







       '''simple docstring'''
       raise NotImplementedError()



