



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 							SCREAMING_SNAKE_CASE__  (      __a				):  # picklable for multiprocessing
	return i + 1


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

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








from decimal import Decimal, getcontext
from math import ceil, factorial


def 							SCREAMING_SNAKE_CASE__  (      __a				):

	if not isinstance(__a				,	__a				):
		raise TypeError('Undefined for non-integers'				)
	elif precision < 1:
		raise ValueError('Undefined for non-natural numbers'				)

	snake_case_						:     Dict     =		precision
	snake_case_						:     str     =		ceil(precision / 14				)
	snake_case_						:     str     =		42_68_80 * Decimal(1_00_05				).sqrt()
	snake_case_						:     Tuple     =		1
	snake_case_						:     int     =		13_59_14_09
	snake_case_						:     Tuple     =		Decimal(__a				)
	for k in range(1				,	__a				):
		snake_case_						:     List[Any]     =		factorial(6 * k				) // (factorial(3 * k				) * factorial(__a				) ** 3)
		linear_term += 5_45_14_01_34
		exponential_term *= -26_25_37_41_26_40_76_80_00
		partial_sum += Decimal(multinomial_term * linear_term				) / exponential_term
	return str(constant_term / partial_sum				)[:-1]


if __name__ == "__main__":
						_SCREAMING_SNAKE_CASE 		=						50
						print(F'''The first {n} digits of pi is: {pi(n)}''')

