
"""simple docstring"""






import pytest

from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs
@pytest.mark.parametrize(
    "kwargs, expected"      ,					[
        ({"num_shards": 0, "max_num_jobs": 1}, []),
        ({"num_shards": 10, "max_num_jobs": 1}, [range(10			)]),
        ({"num_shards": 10, "max_num_jobs": 10}, [range(SCREAMING_SNAKE_CASE__      ,					i + 1			) for i in range(10			)]),
        ({"num_shards": 1, "max_num_jobs": 10}, [range(1			)]),
        ({"num_shards": 10, "max_num_jobs": 3}, [range(0      ,					4			), range(4      ,					7			), range(7      ,					10			)]),
        ({"num_shards": 3, "max_num_jobs": 10}, [range(0      ,					1			), range(1      ,					2			), range(2      ,					3			)]),
    ]      ,					)
def 					UpperCamelCase		( UpperCAmelCase      ,					UpperCAmelCase			)		->Optional[Any]:

   """simple docstring"""



   a_							=			_distribute_shards(**SCREAMING_SNAKE_CASE__			)
   assert out == expected
@pytest.mark.parametrize(
    "gen_kwargs, max_num_jobs, expected"      ,					[
        ({"foo": 0}, 10, [{"foo": 0}]),
        ({"shards": [0, 1, 2, 3]}, 1, [{"shards": [0, 1, 2, 3]}]),
        ({"shards": [0, 1, 2, 3]}, 4, [{"shards": [0]}, {"shards": [1]}, {"shards": [2]}, {"shards": [3]}]),
        ({"shards": [0, 1]}, 4, [{"shards": [0]}, {"shards": [1]}]),
        ({"shards": [0, 1, 2, 3]}, 2, [{"shards": [0, 1]}, {"shards": [2, 3]}]),
    ]      ,					)
def 					UpperCamelCase		( UpperCAmelCase      ,					UpperCAmelCase      ,					UpperCAmelCase			)		->Optional[Any]:

   """simple docstring"""



   a_							=			_split_gen_kwargs(SCREAMING_SNAKE_CASE__      ,					SCREAMING_SNAKE_CASE__			)
   assert out == expected



@pytest.mark.parametrize(
    "gen_kwargs, expected"      ,					[
        ({"foo": 0}, 1),
        ({"shards": [0]}, 1),
        ({"shards": [0, 1, 2, 3]}, 4),
        ({"shards": [0, 1, 2, 3], "foo": 0}, 4),
        ({"shards": [0, 1, 2, 3], "other": (0, 1)}, 4),
        ({"shards": [0, 1, 2, 3], "shards2": [0, 1]}, RuntimeError),
    ]      ,					)
def 					UpperCamelCase		( UpperCAmelCase      ,					UpperCAmelCase			)		->int:

   """simple docstring"""



   if expected is RuntimeError:
      with pytest.raises(SCREAMING_SNAKE_CASE__			):
         _number_of_shards_in_gen_kwargs(SCREAMING_SNAKE_CASE__			)
   else:
      a_							=			_number_of_shards_in_gen_kwargs(SCREAMING_SNAKE_CASE__			)
      assert out == expected


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


def   __SCREAMING_SNAKE_CASE					(SCREAMING_SNAKE_CASE__       ):

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

						snake_case_   =	precision
						snake_case_   =	ceil(precision / 14       )
						snake_case_   =	426880 * Decimal(10005       ).sqrt()
						snake_case_   =	1
						snake_case_   =	13591409
						snake_case_   =	Decimal(SCREAMING_SNAKE_CASE__       )
						for k in range(1  ,		SCREAMING_SNAKE_CASE__       ):
												snake_case_   =	factorial(6 * k       ) // (factorial(3 * k       ) * factorial(SCREAMING_SNAKE_CASE__       ) ** 3)
												linear_term += 545140134
												exponential_term *= -262537412640768000
												partial_sum += Decimal(multinomial_term * linear_term       ) / exponential_term
						return str(constant_term / partial_sum       )[:-1]


if __name__ == "__main__":
					lowerCAmelCase_       	=	50
					print(f"""The first {n} digits of pi is: {pi(n)}""")