






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   _lowerCamelCase						(    __A     :				Tuple			)   ->       List[str]:  # picklable for multiprocessing
    return i + 1

@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def   _lowerCamelCase						(    )   ->       Union[str, Any]:
    with parallel_backend('''spark'''			):
        assert ParallelBackendConfig.backend_name == "spark"

    _UpperCAmelCase					:   Tuple      	=					[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   _lowerCamelCase						(    __A     :				Any			)   ->       int:
    _UpperCAmelCase					:   Dict      	=					[1, 2]
    _UpperCAmelCase					:   List[str]      	=					{'''a''': 1, '''b''': 2}
    _UpperCAmelCase					:   Optional[Any]      	=					{'''a''': [1, 2], '''b''': [3, 4]}
    _UpperCAmelCase					:   Union[str, Any]      	=					{'''a''': {'''1''': 1}, '''b''': 2}
    _UpperCAmelCase					:   List[str]      	=					{'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
    _UpperCAmelCase					:   Dict      	=					[2, 3]
    _UpperCAmelCase					:   Optional[Any]      	=					{'''a''': 2, '''b''': 3}
    _UpperCAmelCase					:   Optional[int]      	=					{'''a''': [2, 3], '''b''': [4, 5]}
    _UpperCAmelCase					:   int      	=					{'''a''': {'''1''': 2}, '''b''': 3}
    _UpperCAmelCase					:   List[Any]      	=					{'''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





def 	lowerCamelCase					(	UpperCamelCase     :				int			,       UpperCamelCase     :				int							)   ->    float:
		return base * power(UpperCamelCase			,       (exponent - 1)							) if exponent else 1


if __name__ == "__main__":
				print('Raise base to the power of exponent using recursion...')
				A						=			int(input('Enter the base: ').strip())
				A						=			int(input('Enter the exponent: ').strip())
				A						=			power(base, abs(exponent))
				if exponent < 0:  # power() does not properly deal w/ negative exponents
								A						=			1 / result
				print(F'''{base} to the power of {exponent} is {result}''')