





import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__lowercase	: Optional[int]       =logging.getLogger()

@unittest.skip('''Temporarily disable the doc tests.'''    )
@require_torch
@require_tf
@slow
class   A							(						unittest.TestCase    ):



      def 						lowerCAmelCase__     (						self:    str		,	_lowerCAmelCase:    Path		,	_lowerCAmelCase:    Union[str, None] = None		,	_lowerCAmelCase:    Union[List[str], None] = None		,	_lowerCAmelCase:    Union[str, List[str], None] = None		,	_lowerCAmelCase:    bool = True		,	)    ->     Dict:
         '''simple docstring'''

         UpperCAmelCase_           =[file for file in os.listdir(_lowerCAmelCase							) if os.path.isfile(os.path.join(_lowerCAmelCase		,	_lowerCAmelCase							)							)]

         if identifier is not None:
            UpperCAmelCase_           =[file for file in files if identifier in file]

         if n_identifier is not None:
            if isinstance(_lowerCAmelCase		,	_lowerCAmelCase							):
               for n_ in n_identifier:
                  UpperCAmelCase_           =[file for file in files if n_ not in file]
            else:
               UpperCAmelCase_           =[file for file in files if n_identifier not in file]

         UpperCAmelCase_           =ignore_files or []
         ignore_files.append("__init__.py"							)
         UpperCAmelCase_           =[file for file in files if file not in ignore_files]

         for file in files:
            # Open all files
            print("Testing"		,	_lowerCAmelCase							)

            if only_modules:
               UpperCAmelCase_           =file.split("."							)[0]
               try:
                  UpperCAmelCase_           =getattr(_lowerCAmelCase		,	_lowerCAmelCase							)
                  UpperCAmelCase_           =doctest.DocTestSuite(_lowerCAmelCase							)
                  UpperCAmelCase_           =unittest.TextTestRunner().run(_lowerCAmelCase							)
                  self.assertIs(len(result.failures							)		,	0							)
               except AttributeError:
                  logger.info(F'{module_identifier} is not a module.'							)
            else:
               UpperCAmelCase_           =doctest.testfile(str(".." / directory / file							)		,	optionflags=doctest.ELLIPSIS							)
               self.assertIs(result.failed		,	0							)



      def 						lowerCAmelCase__     (						self:    Optional[int]							)    ->     Tuple:
         '''simple docstring'''

         UpperCAmelCase_           =Path("src/transformers"							)
         UpperCAmelCase_           ="modeling"
         UpperCAmelCase_           =[
             "modeling_ctrl.py",
             "modeling_tf_ctrl.py",
         ]
         self.analyze_directory(_lowerCAmelCase		,	identifier=_lowerCAmelCase		,	ignore_files=_lowerCAmelCase							)



      def 						lowerCAmelCase__     (						self:    Tuple							)    ->     Optional[int]:
         '''simple docstring'''

         UpperCAmelCase_           =Path("src/transformers"							)
         UpperCAmelCase_           ="tokenization"
         self.analyze_directory(_lowerCAmelCase		,	identifier=_lowerCAmelCase							)



      def 						lowerCAmelCase__     (						self:    List[Any]							)    ->     Tuple:
         '''simple docstring'''

         UpperCAmelCase_           =Path("src/transformers"							)
         UpperCAmelCase_           ="configuration"
         self.analyze_directory(_lowerCAmelCase		,	identifier=_lowerCAmelCase							)



      def 						lowerCAmelCase__     (						self:    List[str]							)    ->     Union[str, Any]:
         '''simple docstring'''

         UpperCAmelCase_           =Path("src/transformers"							)
         UpperCAmelCase_           =["configuration", "modeling", "tokenization"]
         self.analyze_directory(_lowerCAmelCase		,	n_identifier=_lowerCAmelCase							)






      def 						lowerCAmelCase__     (						self:    List[Any]							)    ->     List[Any]:
         '''simple docstring'''

         UpperCAmelCase_           =Path("docs/source"							)
         UpperCAmelCase_           =["favicon.ico"]
         self.analyze_directory(_lowerCAmelCase		,	ignore_files=_lowerCAmelCase		,	only_modules=_lowerCAmelCase							)











from __future__ import annotations

# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
UpperCamelCase__           =			10





def      _UpperCamelCase  (a__ :int ,      a__ :int ,      a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							for i in range(a__ ,      a__							):
														if array[i] == target:
																					return i
							return -1





def      _UpperCamelCase  (a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							UpperCamelCase__					  =      0
							UpperCamelCase__					  =      len(a__							)
							while left <= right:
														if right - left < precision:
																					return lin_search(a__ ,      a__ ,      a__ ,      a__							)

														UpperCamelCase__					  =      (left + right) // 3 + 1
														UpperCamelCase__					  =      2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					UpperCamelCase__					  =      one_third - 1
														elif array[two_third] < target:
																					UpperCamelCase__					  =      two_third + 1

														else:
																					UpperCamelCase__					  =      one_third + 1
																					UpperCamelCase__					  =      two_third - 1
							else:
														return -1





def      _UpperCamelCase  (a__ :int ,      a__ :int ,      a__ :list[int] ,      a__ :int							):






							"""simple docstring"""





							if left < right:
														if right - left < precision:
																					return lin_search(a__ ,      a__ ,      a__ ,      a__							)
														UpperCamelCase__					  =      (left + right) // 3 + 1
														UpperCamelCase__					  =      2 * (left + right) // 3 + 1

														if array[one_third] == target:
																					return one_third
														elif array[two_third] == target:
																					return two_third

														elif target < array[one_third]:
																					return rec_ternary_search(a__ ,      one_third - 1 ,      a__ ,      a__							)
														elif array[two_third] < target:
																					return rec_ternary_search(two_third + 1 ,      a__ ,      a__ ,      a__							)
														else:
																					return rec_ternary_search(one_third + 1 ,      two_third - 1 ,      a__ ,      a__							)
							else:
														return -1


if __name__ == "__main__":
					import doctest

					doctest.testmod()

					UpperCamelCase__           =			input("Enter numbers separated by comma:\n").strip()
					UpperCamelCase__           =			[int(item.strip()) for item in user_input.split(",")]
					assert collection == sorted(collection), f"List must be ordered.\n{collection}."
					UpperCamelCase__           =			int(input("Enter the number to be found in the list:\n").strip())
					UpperCamelCase__           =			ite_ternary_search(collection, target)
					UpperCamelCase__           =			rec_ternary_search(0, len(collection) - 1, collection, target)
					if resulta != -1:
										print(f"""Iterative search: {target} found at positions: {resulta}""")
										print(f"""Recursive search: {target} found at positions: {resulta}""")
					else:
										print("Not found")




