


'''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 			UpperCAmelCase__					(	UpperCAmelCase_    :				List[Any]							)     ->		List[Any]:  # picklable for multiprocessing
     return i + 1



@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 			UpperCAmelCase__					(	)     ->		Optional[Any]:
     with parallel_backend('spark'							):
          assert ParallelBackendConfig.backend_name == "spark"

     __lowerCamelCase   :	Tuple								=		[1, 2, 3]
     with pytest.raises(__snake_case							):
          with parallel_backend('unsupported backend'							):
               map_nested(__snake_case      ,    __snake_case      ,    num_proc=2							)

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



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

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











"""simple docstring"""






import re


def 			_lowercase				(  __snake_case	)						->   str:

			if len(re.findall("[ATCG]"					,__snake_case	)	) != len(__snake_case	):
						raise ValueError("Invalid Strand"	)

			return dna.translate(dna.maketrans("ATCG"					,"TAGC"	)	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()