


"""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						(						_snake_case				:			Dict			):  # picklable for multiprocessing
      return i + 1


@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def      _snake_case						(						):
      with parallel_backend('''spark'''			):
            assert ParallelBackendConfig.backend_name == "spark"

      lowerCAmelCase					:	str       =   [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      _snake_case						(						_snake_case				:			str			):
      lowerCAmelCase					:	Any       =   [1, 2]
      lowerCAmelCase					:	List[str]       =   {'''a''': 1, '''b''': 2}
      lowerCAmelCase					:	int       =   {'''a''': [1, 2], '''b''': [3, 4]}
      lowerCAmelCase					:	str       =   {'''a''': {'''1''': 1}, '''b''': 2}
      lowerCAmelCase					:	List[str]       =   {'''a''': 1, '''b''': 2, '''c''': 3, '''d''': 4}
      lowerCAmelCase					:	Optional[Any]       =   [2, 3]
      lowerCAmelCase					:	Optional[Any]       =   {'''a''': 2, '''b''': 3}
      lowerCAmelCase					:	Optional[int]       =   {'''a''': [2, 3], '''b''': [4, 5]}
      lowerCAmelCase					:	str       =   {'''a''': {'''1''': 2}, '''b''': 3}
      lowerCAmelCase					:	Any       =   {'''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"""





def      _snake_case						(						_snake_case				:			int ,   _snake_case				:			int			):
      return base * power(_snake_case ,   (exponent - 1)			) if exponent else 1


if __name__ == "__main__":
 print('''Raise base to the power of exponent using recursion...''')
 snake_case__		:     Union[str, Any]    				=				int(input('''Enter the base: ''').strip())
 snake_case__		:     Optional[Any]    				=				int(input('''Enter the exponent: ''').strip())
 snake_case__		:     Any    				=				power(base, abs(exponent))
 if exponent < 0:  # power() does not properly deal w/ negative exponents
  snake_case__		:     Dict    				=				1 / result
 print(f"""{base} to the power of {exponent} is {result}""")


