


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


UpperCAmelCase_   :				List[Any]						      = logging.getLogger()
@unittest.skip('''Temporarily disable the doc tests.'''    )
@require_torch
@require_tf
@slow
class 				SCREAMING_SNAKE_CASE__						(       unittest.TestCase    ):
      def  SCREAMING_SNAKE_CASE							( self       : Optional[int]  ,							SCREAMING_SNAKE_CASE__       : Path  ,							SCREAMING_SNAKE_CASE__       : Union[str, None] = None  ,							SCREAMING_SNAKE_CASE__       : Union[List[str], None] = None  ,							SCREAMING_SNAKE_CASE__       : Union[str, List[str], None] = None  ,							SCREAMING_SNAKE_CASE__       : bool = True  ,							)	->    Union[str, Any]:
             a_      :	Dict							=						[file for file in os.listdir(SCREAMING_SNAKE_CASE__  ) if os.path.isfile(os.path.join(SCREAMING_SNAKE_CASE__  ,							SCREAMING_SNAKE_CASE__  )  )]

             if identifier is not None:
                    a_      :	List[str]							=						[file for file in files if identifier in file]

             if n_identifier is not None:
                    if isinstance(SCREAMING_SNAKE_CASE__  ,							SCREAMING_SNAKE_CASE__  ):
                           for n_ in n_identifier:
                                  a_      :	Optional[Any]							=						[file for file in files if n_ not in file]
                    else:
                           a_      :	Union[str, Any]							=						[file for file in files if n_identifier not in file]

             a_      :	int							=						ignore_files or []
             ignore_files.append('__init__.py'  )
             a_      :	Dict							=						[file for file in files if file not in ignore_files]

             for file in files:
                    # Open all files
                    print('Testing'  ,							SCREAMING_SNAKE_CASE__  )

                    if only_modules:
                           a_      :	List[Any]							=						file.split('.'  )[0]
                           try:
                                  a_      :	Tuple							=						getattr(SCREAMING_SNAKE_CASE__  ,							SCREAMING_SNAKE_CASE__  )
                                  a_      :	List[Any]							=						doctest.DocTestSuite(SCREAMING_SNAKE_CASE__  )
                                  a_      :	Union[str, Any]							=						unittest.TextTestRunner().run(SCREAMING_SNAKE_CASE__  )
                                  self.assertIs(len(result.failures  )  ,							0  )
                           except AttributeError:
                                  logger.info(F"""{module_identifier} is not a module."""  )
                    else:
                           a_      :	Optional[int]							=						doctest.testfile(str('..' / directory / file  )  ,							optionflags=doctest.ELLIPSIS  )
                           self.assertIs(result.failed  ,							0  )
      def  SCREAMING_SNAKE_CASE							( self       : Optional[int]  )	->    str:
             a_      :	Union[str, Any]							=						Path('src/transformers'  )
             a_      :	Dict							=						'modeling'
             a_      :	int							=						[
                 'modeling_ctrl.py',
                 'modeling_tf_ctrl.py',
             ]
             self.analyze_directory(SCREAMING_SNAKE_CASE__  ,							identifier=SCREAMING_SNAKE_CASE__  ,							ignore_files=SCREAMING_SNAKE_CASE__  )
      def  SCREAMING_SNAKE_CASE							( self       : Optional[int]  )	->    Dict:
             a_      :	List[str]							=						Path('src/transformers'  )
             a_      :	str							=						'tokenization'
             self.analyze_directory(SCREAMING_SNAKE_CASE__  ,							identifier=SCREAMING_SNAKE_CASE__  )
      def  SCREAMING_SNAKE_CASE							( self       : Optional[Any]  )	->    Dict:
             a_      :	Optional[int]							=						Path('src/transformers'  )
             a_      :	Dict							=						'configuration'
             self.analyze_directory(SCREAMING_SNAKE_CASE__  ,							identifier=SCREAMING_SNAKE_CASE__  )
      def  SCREAMING_SNAKE_CASE							( self       : Any  )	->    Optional[int]:
             a_      :	int							=						Path('src/transformers'  )
             a_      :	Optional[int]							=						['configuration', 'modeling', 'tokenization']
             self.analyze_directory(SCREAMING_SNAKE_CASE__  ,							n_identifier=SCREAMING_SNAKE_CASE__  )

      def  SCREAMING_SNAKE_CASE							( self       : Tuple  )	->    List[str]:
             a_      :	Union[str, Any]							=						Path('docs/source'  )
             a_      :	Optional[int]							=						['favicon.ico']
             self.analyze_directory(SCREAMING_SNAKE_CASE__  ,							ignore_files=SCREAMING_SNAKE_CASE__  ,							only_modules=SCREAMING_SNAKE_CASE__  )






def  SCREAMING_SNAKE_CASE_		(    __A				:    str       )			->	list:

       """simple docstring"""

       return [
           txt[:a] + txt[a].upper() + txt[a + 1 :]
           for a in range(len(__A       )       )
           if txt[a].isalpha()
       ]


if __name__ == "__main__":
   __import__('doctest').testmod()


