'''simple docstring'''





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





def      lowerCAmelCase_    ( snake_case_	:			str      )   ->				Optional[int]:


     '''simple docstring'''




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

     UpperCAmelCase_	   =       precision
     UpperCAmelCase_	   =       ceil(precision / 14      )
     UpperCAmelCase_	   =       42_68_80 * Decimal(1_00_05      ).sqrt()
     UpperCAmelCase_	   =       1
     UpperCAmelCase_	   =       13_59_14_09
     UpperCAmelCase_	   =       Decimal(snake_case_      )
     for k in range(1 ,   snake_case_      ):
          UpperCAmelCase_	   =       factorial(6 * k      ) // (factorial(3 * k      ) * factorial(snake_case_      ) ** 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_:					str  =50
    print(f"The first {n} digits of pi is: {pi(n)}")





'''simple docstring'''





import os
import time

import pytest

from datasets.utils.filelock import FileLock, Timeout





def      lowerCAmelCase_    ( snake_case_	:			Union[str, Any]      )   ->				Optional[int]:


     '''simple docstring'''




     UpperCAmelCase_	   =       FileLock(str(tmpdir / "foo.lock"      )      )
     UpperCAmelCase_	   =       FileLock(str(tmpdir / "foo.lock"      )      )
     UpperCAmelCase_	   =       0.01
     with locka.acquire():
          with pytest.raises(snake_case_      ):
               UpperCAmelCase_	   =       time.time()
               locka.acquire(snake_case_      )
               assert time.time() - _start > timeout






def      lowerCAmelCase_    ( snake_case_	:			int      )   ->				Optional[int]:


     '''simple docstring'''




     UpperCAmelCase_	   =       "a" * 10_00 + ".lock"
     UpperCAmelCase_	   =       FileLock(str(tmpdir / filename      )      )
     assert locka._lock_file.endswith(".lock"      )
     assert not locka._lock_file.endswith(snake_case_      )
     assert len(os.path.basename(locka._lock_file      )      ) <= 2_55
     UpperCAmelCase_	   =       FileLock(tmpdir / filename      )
     with locka.acquire():
          with pytest.raises(snake_case_      ):
               locka.acquire(0      )




