



'''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  snake_case_     (					_lowerCAmelCase  :						Union[str, Any]  )      ->   Dict:  # picklable for multiprocessing
							return i + 1


@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def  snake_case_     (					)      ->   Tuple:
							with parallel_backend('''spark'''  ):
														assert ParallelBackendConfig.backend_name == "spark"

							UpperCAmelCase :       Any 							=		[1, 2, 3]
							with pytest.raises(a_  ):
														with parallel_backend('''unsupported backend'''  ):
																					map_nested(a_   ,      a_   ,      num_proc=2  )

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




@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize('''num_proc'''   ,      [2, -1]  )
def  snake_case_     (					_lowerCAmelCase  :						Union[str, Any]  )      ->   Optional[int]:
							UpperCAmelCase :       int 							=		[1, 2]
							UpperCAmelCase :       int 							=		{'''a''': 1, '''b''': 2}
							UpperCAmelCase :       Optional[int] 							=		{'''a''': [1, 2], '''b''': [3, 4]}
							UpperCAmelCase :       str 							=		{'''a''': {'''1''': 1}, '''b''': 2}
							UpperCAmelCase :       Dict 							=		{'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
							UpperCAmelCase :       int 							=		[2, 3]
							UpperCAmelCase :       Union[str, Any] 							=		{'''a''': 2, '''b''': 3}
							UpperCAmelCase :       List[str] 							=		{'''a''': [2, 3], '''b''': [4, 5]}
							UpperCAmelCase :       List[Any] 							=		{'''a''': {'''1''': 2}, '''b''': 3}
							UpperCAmelCase :       int 							=		{'''a''': 2, '''b''': 3, '''c''': 4, '''d''': 5}

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













from typing import TYPE_CHECKING

from ...utils import _LazyModule


lowercase  							=					{"processing_wav2vec2_with_lm": ["Wav2Vec2ProcessorWithLM"]}


if TYPE_CHECKING:
	from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
	import sys

	lowercase  							=					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





