




'''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


UpperCamelCase_						:      Tuple       =						logging.getLogger()

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






     def     _lowercase     (			self ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE = None ,_SCREAMING_SNAKE_CASE = None ,_SCREAMING_SNAKE_CASE = None ,_SCREAMING_SNAKE_CASE = True ,)							->      Optional[int]:
          _snake_case							=				[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:
               _snake_case							=				[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:
                         _snake_case							=				[file for file in files if n_ not in file]
               else:
                    _snake_case							=				[file for file in files if n_identifier not in file]

          _snake_case							=				ignore_files or []
          ignore_files.append("__init__.py"   )
          _snake_case							=				[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:
                    _snake_case							=				file.split("."   )[0]
                    try:
                         _snake_case							=				getattr(_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE   )
                         _snake_case							=				doctest.DocTestSuite(_SCREAMING_SNAKE_CASE   )
                         _snake_case							=				unittest.TextTestRunner().run(_SCREAMING_SNAKE_CASE   )
                         self.assertIs(len(result.failures   ) ,0   )
                    except AttributeError:
                         logger.info(f"""{module_identifier} is not a module."""   )
               else:
                    _snake_case							=				doctest.testfile(str(".." / directory / file   ) ,optionflags=doctest.ELLIPSIS   )
                    self.assertIs(result.failed ,0   )






     def     _lowercase     (			self   )							->      List[Any]:
          _snake_case							=				Path("src/transformers"   )
          _snake_case							=				"modeling"
          _snake_case							=				[
              "modeling_ctrl.py",
              "modeling_tf_ctrl.py",
          ]
          self.analyze_directory(_SCREAMING_SNAKE_CASE ,identifier=_SCREAMING_SNAKE_CASE ,ignore_files=_SCREAMING_SNAKE_CASE   )






     def     _lowercase     (			self   )							->      Tuple:
          _snake_case							=				Path("src/transformers"   )
          _snake_case							=				"tokenization"
          self.analyze_directory(_SCREAMING_SNAKE_CASE ,identifier=_SCREAMING_SNAKE_CASE   )






     def     _lowercase     (			self   )							->      Tuple:
          _snake_case							=				Path("src/transformers"   )
          _snake_case							=				"configuration"
          self.analyze_directory(_SCREAMING_SNAKE_CASE ,identifier=_SCREAMING_SNAKE_CASE   )






     def     _lowercase     (			self   )							->      List[Any]:
          _snake_case							=				Path("src/transformers"   )
          _snake_case							=				["configuration", "modeling", "tokenization"]
          self.analyze_directory(_SCREAMING_SNAKE_CASE ,n_identifier=_SCREAMING_SNAKE_CASE   )






     def     _lowercase     (			self   )							->      List[str]:
          _snake_case							=				Path("docs/source"   )
          _snake_case							=				["favicon.ico"]
          self.analyze_directory(_SCREAMING_SNAKE_CASE ,ignore_files=_SCREAMING_SNAKE_CASE ,only_modules=_SCREAMING_SNAKE_CASE   )








'''simple docstring'''





from typing import TYPE_CHECKING

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


UpperCamelCase_						:      Union[str, Any]       =						{'''configuration_plbart''': ['''PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PLBartConfig''']}

try:
   if not is_sentencepiece_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   UpperCamelCase_						:      Optional[int]       =						['''PLBartTokenizer''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   UpperCamelCase_						:      int       =						[
       '''PLBART_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''PLBartForCausalLM''',
       '''PLBartForConditionalGeneration''',
       '''PLBartForSequenceClassification''',
       '''PLBartModel''',
       '''PLBartPreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_plbart import PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP, PLBartConfig

   try:
      if not is_sentencepiece_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_plbart import PLBartTokenizer

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_plbart import (
          PLBART_PRETRAINED_MODEL_ARCHIVE_LIST,
          PLBartForCausalLM,
          PLBartForConditionalGeneration,
          PLBartForSequenceClassification,
          PLBartModel,
          PLBartPreTrainedModel,
      )


else:
   import sys

   UpperCamelCase_						:      str       =						_LazyModule(__name__, globals()['''__file__'''], _import_structure)


