


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


SCREAMING_SNAKE_CASE       :		List[Any]         =				logging.getLogger()






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


   '''simple docstring'''







   def 		UpperCamelCase  (     self   ,							UpperCamelCase_   ,							UpperCamelCase_ = None   ,							UpperCamelCase_ = None   ,							UpperCamelCase_ = None   ,							UpperCamelCase_ = True   ,							):
        lowercase_       :Any     =       [file for file in os.listdir(UpperCamelCase_		) if os.path.isfile(os.path.join(UpperCamelCase_   ,							UpperCamelCase_		)		)]

        if identifier is not None:
             lowercase_       :Union[str, Any]     =       [file for file in files if identifier in file]

        if n_identifier is not None:
             if isinstance(UpperCamelCase_   ,							UpperCamelCase_		):
                  for n_ in n_identifier:
                       lowercase_       :Dict     =       [file for file in files if n_ not in file]
             else:
                  lowercase_       :Optional[int]     =       [file for file in files if n_identifier not in file]

        lowercase_       :List[str]     =       ignore_files or []
        ignore_files.append('''__init__.py'''		)
        lowercase_       :Optional[int]     =       [file for file in files if file not in ignore_files]

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

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




   def 		UpperCamelCase  (     self		):
        lowercase_       :str     =       Path('''docs/source'''		)
        lowercase_       :str     =       ['''favicon.ico''']
        self.analyze_directory(UpperCamelCase_   ,							ignore_files=UpperCamelCase_   ,							only_modules=UpperCamelCase_		)





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


SCREAMING_SNAKE_CASE       :		str         =				{
    "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"],
    "tokenization_tapas": ["TapasTokenizer"],
}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE       :		Dict         =				[
       "TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST",
       "TapasForMaskedLM",
       "TapasForQuestionAnswering",
       "TapasForSequenceClassification",
       "TapasModel",
       "TapasPreTrainedModel",
       "load_tf_weights_in_tapas",
   ]
try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   SCREAMING_SNAKE_CASE       :		str         =				[
       "TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST",
       "TFTapasForMaskedLM",
       "TFTapasForQuestionAnswering",
       "TFTapasForSequenceClassification",
       "TFTapasModel",
       "TFTapasPreTrainedModel",
   ]


if TYPE_CHECKING:
   from .configuration_tapas import TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP, TapasConfig
   from .tokenization_tapas import TapasTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tapas import (
          TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
          TapasForMaskedLM,
          TapasForQuestionAnswering,
          TapasForSequenceClassification,
          TapasModel,
          TapasPreTrainedModel,
          load_tf_weights_in_tapas,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_tapas import (
          TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFTapasForMaskedLM,
          TFTapasForQuestionAnswering,
          TFTapasForSequenceClassification,
          TFTapasModel,
          TFTapasPreTrainedModel,
      )


else:
   import sys

   SCREAMING_SNAKE_CASE       :		Union[str, Any]         =				_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)

