

'''simple docstring'''






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


lowerCAmelCase__   		=      logging.getLogger()






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




  """simple docstring"""




  def    SCREAMING_SNAKE_CASE ( self  :	List[Any]   ,lowercase__  :	Path   ,lowercase__  :	Union[str, None] = None   ,lowercase__  :	Union[List[str], None] = None   ,lowercase__  :	Union[str, List[str], None] = None   ,lowercase__  :	bool = True   ,):
   __lowercase				    =					[file for file in os.listdir(lowercase__     ) if os.path.isfile(os.path.join(lowercase__   ,lowercase__     )     )]

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

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

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

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

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






  def    SCREAMING_SNAKE_CASE ( self  :	Optional[int]     ):
   __lowercase				    =					Path('''src/transformers'''     )
   __lowercase				    =					'''modeling'''
   __lowercase				    =					[
       '''modeling_ctrl.py''',
       '''modeling_tf_ctrl.py''',
   ]
   self.analyze_directory(lowercase__   ,identifier=lowercase__   ,ignore_files=lowercase__     )






  def    SCREAMING_SNAKE_CASE ( self  :	Optional[Any]     ):
   __lowercase				    =					Path('''src/transformers'''     )
   __lowercase				    =					'''tokenization'''
   self.analyze_directory(lowercase__   ,identifier=lowercase__     )






  def    SCREAMING_SNAKE_CASE ( self  :	int     ):
   __lowercase				    =					Path('''src/transformers'''     )
   __lowercase				    =					'''configuration'''
   self.analyze_directory(lowercase__   ,identifier=lowercase__     )






  def    SCREAMING_SNAKE_CASE ( self  :	Union[str, Any]     ):
   __lowercase				    =					Path('''src/transformers'''     )
   __lowercase				    =					['''configuration''', '''modeling''', '''tokenization''']
   self.analyze_directory(lowercase__   ,n_identifier=lowercase__     )






  def    SCREAMING_SNAKE_CASE ( self  :	str     ):
   __lowercase				    =					Path('''docs/source'''     )
   __lowercase				    =					['''favicon.ico''']
   self.analyze_directory(lowercase__   ,ignore_files=lowercase__   ,only_modules=lowercase__     )



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


_lowercase											=    {
    """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowercase											=    [
     """FALCON_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """FalconForCausalLM""",
     """FalconModel""",
     """FalconPreTrainedModel""",
     """FalconForSequenceClassification""",
     """FalconForTokenClassification""",
     """FalconForQuestionAnswering""",
 ]


if TYPE_CHECKING:
 from .configuration_falcon import FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP, FalconConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_falcon import (
      FALCON_PRETRAINED_MODEL_ARCHIVE_LIST,
      FalconForCausalLM,
      FalconForQuestionAnswering,
      FalconForSequenceClassification,
      FalconForTokenClassification,
      FalconModel,
      FalconPreTrainedModel,
  )


else:
 import sys

 _lowercase											=    _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
