




"""simple docstring"""

import os
import sys
import unittest


a					=			os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(git_repo_path, '''utils'''))

import check_dummies  # noqa: E402
from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_init  # noqa: E402


# Align TRANSFORMERS_PATH in check_dummies with the current path
a					=			os.path.join(git_repo_path, '''src''', '''transformers''')

a					=			'''\n{0} = None\n'''

a					=			'''\nclass {0}(metaclass=DummyObject):\n    _backends = {1}\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, {1})\n'''


a					=			'''\ndef {0}(*args, **kwargs):\n    requires_backends({0}, {1})\n'''





class 				lowercase_       (     unittest.TestCase							):



 '''simple docstring'''

 def 			lowerCAmelCase_							( self       :       Optional[int]		):
       _A					   =   find_backend('    _import_structure[\"models.albert\"].append(\"AlbertTokenizerFast\")'		)
       self.assertIsNone(UpperCAmelCase__		)

       _A					   =   find_backend('    if not is_tokenizers_available():'		)
       self.assertEqual(UpperCAmelCase__    ,							'tokenizers'		)

       _A					   =   find_backend('    if not is_tensorflow_text_available():'		)
       self.assertEqual(UpperCAmelCase__    ,							'tensorflow_text'		)

       _A					   =   find_backend('    if not (is_sentencepiece_available() and is_tokenizers_available()):'		)
       self.assertEqual(UpperCAmelCase__    ,							'sentencepiece_and_tokenizers'		)

       _A					   =   find_backend(
           '    if not (is_sentencepiece_available() and is_tensorflow_text_available()):'		)
       self.assertEqual(UpperCAmelCase__    ,							'sentencepiece_and_tensorflow_text'		)

       _A					   =   find_backend(
           '    if not (is_sentencepiece_available() and is_tokenizers_available() and is_vision_available()):'		)
       self.assertEqual(UpperCAmelCase__    ,							'sentencepiece_and_tokenizers_and_vision'		)

 def 			lowerCAmelCase_							( self       :       Tuple		):
       _A					   =   read_init()
       # We don't assert on the exact list of keys to allow for smooth grow of backend-specific objects
       self.assertIn('torch'    ,							UpperCAmelCase__		)
       self.assertIn('tensorflow_text'    ,							UpperCAmelCase__		)
       self.assertIn('sentencepiece_and_tokenizers'    ,							UpperCAmelCase__		)

       # Likewise, we can't assert on the exact content of a key
       self.assertIn('BertModel'    ,							objects['torch']		)
       self.assertIn('TFBertModel'    ,							objects['tf']		)
       self.assertIn('FlaxBertModel'    ,							objects['flax']		)
       self.assertIn('BertModel'    ,							objects['torch']		)
       self.assertIn('TFBertTokenizer'    ,							objects['tensorflow_text']		)
       self.assertIn('convert_slow_tokenizer'    ,							objects['sentencepiece_and_tokenizers']		)

 def 			lowerCAmelCase_							( self       :       Optional[Any]		):
       _A					   =   create_dummy_object('CONSTANT'    ,							'\'torch\''		)
       self.assertEqual(UpperCAmelCase__    ,							'\nCONSTANT = None\n'		)

       _A					   =   create_dummy_object('function'    ,							'\'torch\''		)
       self.assertEqual(
           UpperCAmelCase__    ,							'\ndef function(*args, **kwargs):\n    requires_backends(function, \'torch\')\n'		)

       _A					   =   '\nclass FakeClass(metaclass=DummyObject):\n    _backends = \'torch\'\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, \'torch\')\n'
       _A					   =   create_dummy_object('FakeClass'    ,							'\'torch\''		)
       self.assertEqual(UpperCAmelCase__    ,							UpperCAmelCase__		)



 def 			lowerCAmelCase_							( self       :       List[Any]		):
       _A					   =   '# This file is autogenerated by the command `make fix-copies`, do not edit.\nfrom ..utils import DummyObject, requires_backends\n\n\nCONSTANT = None\n\n\ndef function(*args, **kwargs):\n    requires_backends(function, [\"torch\"])\n\n\nclass FakeClass(metaclass=DummyObject):\n    _backends = [\"torch\"]\n\n    def __init__(self, *args, **kwargs):\n        requires_backends(self, [\"torch\"])\n'
       _A					   =   create_dummy_files({'torch': ['CONSTANT', 'function', 'FakeClass']}		)
       self.assertEqual(dummy_files['torch']    ,							UpperCAmelCase__		)




"""simple docstring"""





from collections.abc import Sequence




def   _A  (  UpperCamelCase_     :       Sequence[float],			UpperCamelCase_     :       float)	->						float:
   '''simple docstring'''


   return sum(c * (x**i) for i, c in enumerate(UpperCamelCase_))




def   _A  (  UpperCamelCase_     :       Sequence[float],			UpperCamelCase_     :       float)	->						float:
   '''simple docstring'''


   __lowercase								=						0.0
   for coeff in reversed(UpperCamelCase_):
      __lowercase								=						result * x + coeff
   return result


if __name__ == "__main__":
   _a       =							(0.0, 0.0, 5.0, 9.3, 7.0)
   _a       =							10.0
   print(evaluate_poly(poly, x))
   print(horner(poly, x))




