
import unittest

from transformers.testing_utils import CaptureStdout
from transformers.tools.python_interpreter import evaluate

def a__       (			A_   ):






  '''simple docstring'''





  return x + 2





class 			UpperCAmelCase_     (					unittest.TestCase	):


  '''simple docstring'''







  def 				_lowercase				(					self     :					Tuple       )     ->      str:







    """simple docstring"""






    __magic_name__								=			"""x = 3"""
    __magic_name__								=			{}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    assert result == 3
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3}       )

    __magic_name__								=			"""x = y"""
    __magic_name__								=			{"""y""": 5}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    # evaluate returns the value of the last assignment.
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 5, """y""": 5}       )
  def 				_lowercase				(					self     :					Tuple       )     ->      Union[str, Any]:







    """simple docstring"""






    __magic_name__								=			"""y = add_two(x)"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""add_two""": add_two}     ,				state=UpperCamelCase__       )
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """y""": 5}       )

    # Won't work without the tool
    with CaptureStdout() as out:
      __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    assert result is None
    assert "tried to execute add_two" in out.out
  def 				_lowercase				(					self     :					Optional[int]       )     ->      Optional[int]:







    """simple docstring"""






    __magic_name__								=			"""x = 3"""
    __magic_name__								=			{}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    assert result == 3
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3}       )
  def 				_lowercase				(					self     :					Dict       )     ->      int:







    """simple docstring"""






    __magic_name__								=			"""test_dict = {'x': x, 'y': add_two(x)}"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""add_two""": add_two}     ,				state=UpperCamelCase__       )
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """y""": 5}       )
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """test_dict""": {"""x""": 3, """y""": 5}}       )
  def 				_lowercase				(					self     :					List[str]       )     ->      Union[str, Any]:







    """simple docstring"""






    __magic_name__								=			"""x = 3\ny = 5"""
    __magic_name__								=			{}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    # evaluate returns the value of the last assignment.
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """y""": 5}       )
  def 				_lowercase				(					self     :					List[str]       )     ->      Optional[int]:







    """simple docstring"""






    __magic_name__								=			"""text = f'This is x: {x}.'"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    # evaluate returns the value of the last assignment.
    assert result == "This is x: 3."
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """text""": """This is x: 3."""}       )
  def 				_lowercase				(					self     :					int       )     ->      Optional[Any]:







    """simple docstring"""






    __magic_name__								=			"""if x <= 3:\n    y = 2\nelse:\n    y = 5"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    # evaluate returns the value of the last assignment.
    assert result == 2
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """y""": 2}       )

    __magic_name__								=			{"""x""": 8}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    # evaluate returns the value of the last assignment.
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 8, """y""": 5}       )
  def 				_lowercase				(					self     :					Dict       )     ->      Optional[int]:







    """simple docstring"""






    __magic_name__								=			"""test_list = [x, add_two(x)]"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""add_two""": add_two}     ,				state=UpperCamelCase__       )
    self.assertListEqual(UpperCamelCase__     ,				[3, 5]       )
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """test_list""": [3, 5]}       )
  def 				_lowercase				(					self     :					Optional[Any]       )     ->      Optional[Any]:







    """simple docstring"""






    __magic_name__								=			"""y = x"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{}     ,				state=UpperCamelCase__       )
    assert result == 3
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """y""": 3}       )
  def 				_lowercase				(					self     :					str       )     ->      Dict:







    """simple docstring"""






    __magic_name__								=			"""test_list = [x, add_two(x)]\ntest_list[1]"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""add_two""": add_two}     ,				state=UpperCamelCase__       )
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """test_list""": [3, 5]}       )

    __magic_name__								=			"""test_dict = {'x': x, 'y': add_two(x)}\ntest_dict['y']"""
    __magic_name__								=			{"""x""": 3}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""add_two""": add_two}     ,				state=UpperCamelCase__       )
    assert result == 5
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 3, """test_dict""": {"""x""": 3, """y""": 5}}       )





  def 				_lowercase				(					self     :					Optional[int]       )     ->      int:







    """simple docstring"""






    __magic_name__								=			"""x = 0\nfor i in range(3):\n    x = i"""
    __magic_name__								=			{}
    __magic_name__								=			evaluate(UpperCamelCase__     ,				{"""range""": range}     ,				state=UpperCamelCase__       )
    assert result == 2
    self.assertDictEqual(UpperCamelCase__     ,				{"""x""": 2, """i""": 2}       )



from __future__ import annotations

def a__       (			A_,	A_   ):






  '''simple docstring'''





  if b == 0:
    return (1, 0)
  ((__magic_name__)	,       (__magic_name__))								=			extended_euclid(A_,	a % b   )
  __magic_name__								=			a // b
  return (y, x - k * y)

def a__       (			A_,	A_,	A_,	A_   ):






  '''simple docstring'''





  ((__magic_name__)	,       (__magic_name__))								=			extended_euclid(A_,	A_   )
  __magic_name__								=			na * na
  __magic_name__								=			ra * x * na + ra * y * na
  return (n % m + m) % m

def a__       (			A_,	A_   ):






  '''simple docstring'''





  ((__magic_name__)	,       (__magic_name__))								=			extended_euclid(A_,	A_   )
  if b < 0:
    __magic_name__								=			(b % n + n) % n
  return b

def a__       (			A_,	A_,	A_,	A_   ):






  '''simple docstring'''





  __magic_name__	,       __magic_name__								=			invert_modulo(A_,	A_   ), invert_modulo(A_,	A_   )
  __magic_name__								=			na * na
  __magic_name__								=			ra * x * na + ra * y * na
  return (n % m + m) % m


if __name__ == "__main__":
    from doctest import testmod

    testmod(name='chinese_remainder_theorem', verbose=True)
    testmod(name='chinese_remainder_theorem2', verbose=True)
    testmod(name='invert_modulo', verbose=True)
    testmod(name='extended_euclid', verbose=True)

