



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       a					(       unittest.TestCase      ):

     '''simple docstring'''





     def   lowerCamelCase_       (     self       :      int ,   __snake_case       :      Path ,   __snake_case       :      Union[str, None] = None ,   __snake_case       :      Union[List[str], None] = None ,   __snake_case       :      Union[str, List[str], None] = None ,   __snake_case       :      bool = True ,   ):
         UpperCAmelCase_										=					[file for file in os.listdir(__snake_case    ) if os.path.isfile(os.path.join(__snake_case ,   __snake_case    )    )]

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

         if n_identifier is not None:
             if isinstance(__snake_case ,   __snake_case    ):
                 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''' ,   __snake_case    )

             if only_modules:
                 UpperCAmelCase_										=					file.split('''.'''    )[0]
                 try:
                     UpperCAmelCase_										=					getattr(__snake_case ,   __snake_case    )
                     UpperCAmelCase_										=					doctest.DocTestSuite(__snake_case    )
                     UpperCAmelCase_										=					unittest.TextTestRunner().run(__snake_case    )
                     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       :      List[Any]    ):
         UpperCAmelCase_										=					Path('''src/transformers'''    )
         UpperCAmelCase_										=					"""modeling"""
         UpperCAmelCase_										=					[
             """modeling_ctrl.py""",
             """modeling_tf_ctrl.py""",
         ]
         self.analyze_directory(__snake_case ,   identifier=__snake_case ,   ignore_files=__snake_case    )
     def   lowerCamelCase_       (     self       :      str    ):
         UpperCAmelCase_										=					Path('''src/transformers'''    )
         UpperCAmelCase_										=					"""tokenization"""
         self.analyze_directory(__snake_case ,   identifier=__snake_case    )
     def   lowerCamelCase_       (     self       :      Optional[int]    ):
         UpperCAmelCase_										=					Path('''src/transformers'''    )
         UpperCAmelCase_										=					"""configuration"""
         self.analyze_directory(__snake_case ,   identifier=__snake_case    )
     def   lowerCamelCase_       (     self       :      Tuple    ):
         UpperCAmelCase_										=					Path('''src/transformers'''    )
         UpperCAmelCase_										=					["""configuration""", """modeling""", """tokenization"""]
         self.analyze_directory(__snake_case ,   n_identifier=__snake_case    )




     def   lowerCamelCase_       (     self       :      int    ):
         UpperCAmelCase_										=					Path('''docs/source'''    )
         UpperCAmelCase_										=					["""favicon.ico"""]
         self.analyze_directory(__snake_case ,   ignore_files=__snake_case ,   only_modules=__snake_case    )











from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_lowerCamelCase      			=						{
    'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RobertaConfig', 'RobertaOnnxConfig'],
    'tokenization_roberta': ['RobertaTokenizer'],
}

try:
 if not is_tokenizers_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCamelCase      			=						['RobertaTokenizerFast']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCamelCase      			=						[
     'ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
     'RobertaForCausalLM',
     'RobertaForMaskedLM',
     'RobertaForMultipleChoice',
     'RobertaForQuestionAnswering',
     'RobertaForSequenceClassification',
     'RobertaForTokenClassification',
     'RobertaModel',
     'RobertaPreTrainedModel',
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCamelCase      			=						[
     'TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST',
     'TFRobertaForCausalLM',
     'TFRobertaForMaskedLM',
     'TFRobertaForMultipleChoice',
     'TFRobertaForQuestionAnswering',
     'TFRobertaForSequenceClassification',
     'TFRobertaForTokenClassification',
     'TFRobertaMainLayer',
     'TFRobertaModel',
     'TFRobertaPreTrainedModel',
 ]

try:
 if not is_flax_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 _lowerCamelCase      			=						[
     'FlaxRobertaForCausalLM',
     'FlaxRobertaForMaskedLM',
     'FlaxRobertaForMultipleChoice',
     'FlaxRobertaForQuestionAnswering',
     'FlaxRobertaForSequenceClassification',
     'FlaxRobertaForTokenClassification',
     'FlaxRobertaModel',
     'FlaxRobertaPreTrainedModel',
 ]


if TYPE_CHECKING:
 from .configuration_roberta import ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP, RobertaConfig, RobertaOnnxConfig
 from .tokenization_roberta import RobertaTokenizer

 try:
  if not is_tokenizers_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_roberta_fast import RobertaTokenizerFast

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_roberta import (
      ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
      RobertaForCausalLM,
      RobertaForMaskedLM,
      RobertaForMultipleChoice,
      RobertaForQuestionAnswering,
      RobertaForSequenceClassification,
      RobertaForTokenClassification,
      RobertaModel,
      RobertaPreTrainedModel,
  )

 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_roberta import (
      TF_ROBERTA_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFRobertaForCausalLM,
      TFRobertaForMaskedLM,
      TFRobertaForMultipleChoice,
      TFRobertaForQuestionAnswering,
      TFRobertaForSequenceClassification,
      TFRobertaForTokenClassification,
      TFRobertaMainLayer,
      TFRobertaModel,
      TFRobertaPreTrainedModel,
  )

 try:
  if not is_flax_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_flax_roberta import (
      FlaxRobertaForCausalLM,
      FlaxRobertaForMaskedLM,
      FlaxRobertaForMultipleChoice,
      FlaxRobertaForQuestionAnswering,
      FlaxRobertaForSequenceClassification,
      FlaxRobertaForTokenClassification,
      FlaxRobertaModel,
      FlaxRobertaPreTrainedModel,
  )

else:
 import sys

 _lowerCamelCase      			=						_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)





