
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__    (       A_					):  # picklable for multiprocessing






  '''simple docstring'''





  return i + 1

@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def a__    (       ):






  '''simple docstring'''





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

  __magic_name__				     =       [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 a__    (       A_					):






  '''simple docstring'''





  __magic_name__				     =       [1, 2]
  __magic_name__				     =       {"""a""": 1, """b""": 2}
  __magic_name__				     =       {"""a""": [1, 2], """b""": [3, 4]}
  __magic_name__				     =       {"""a""": {"""1""": 1}, """b""": 2}
  __magic_name__				     =       {"""a""": 1, """b""": 2, """c""": 3, """d""": 4}
  __magic_name__				     =       [2, 3]
  __magic_name__				     =       {"""a""": 2, """b""": 3}
  __magic_name__				     =       {"""a""": [2, 3], """b""": [4, 5]}
  __magic_name__				     =       {"""a""": {"""1""": 2}, """b""": 3}
  __magic_name__				     =       {"""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 ..utils import DummyObject, requires_backends
class        _lowercase      (			metaclass=A__       ):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__				:			Optional[int]						=		['''keras_nlp''']


				def __init__(       self			:Tuple			,			*lowerCAmelCase__			:Optional[Any]			,			**lowerCAmelCase__			:Dict	)		->			Dict:
										requires_backends(self			,			['''keras_nlp''']	)
