





"""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       __A (     a_  :str)						->						Optional[int]:  # picklable for multiprocessing
				return i + 1

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

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






"""simple docstring"""






def       __A (     a_  :float)						->						float:

				if edge <= 0 or not isinstance(a_				,    a_):
								raise ValueError('''Length must be a positive.''')
				return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2)

def       __A (     a_  :float)						->						float:

				if edge <= 0 or not isinstance(a_				,    a_):
								raise ValueError('''Length must be a positive.''')
				return ((15 + (7 * (5 ** (1 / 2)))) / 4) * (edge**3)


if __name__ == "__main__":
		import doctest

		doctest.testmod()