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


lowercase_         =       logging.getLogger()



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




 def 	a   (			self							:			str  , a_							:			Path  , a_							:			Union[str, None] = None  , a_							:			Union[List[str], None] = None  , a_							:			Union[str, List[str], None] = None  , a_							:			bool = True  , )->       Tuple:



      """simple docstring"""

      UpperCAmelCase_    :     int            =	[file for file in os.listdir(__lowerCAmelCase			) if os.path.isfile(os.path.join(__lowerCAmelCase  , __lowerCAmelCase			)			)]

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

      if n_identifier is not None:
           if isinstance(__lowerCAmelCase  , __lowerCAmelCase			):
                for n_ in n_identifier:
                     UpperCAmelCase_    :     str            =	[file for file in files if n_ not in file]
           else:
                UpperCAmelCase_    :     int            =	[file for file in files if n_identifier not in file]

      UpperCAmelCase_    :     int            =	ignore_files or []
      ignore_files.append("""__init__.py"""			)
      UpperCAmelCase_    :     Tuple            =	[file for file in files if file not in ignore_files]

      for file in files:
           # Open all files
           print("""Testing"""  , __lowerCAmelCase			)

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




 def 	a   (			self							:			Tuple			)->       Optional[int]:



      """simple docstring"""

      UpperCAmelCase_    :     Any            =	Path("""src/transformers"""			)
      UpperCAmelCase_    :     int            =	"""modeling"""
      UpperCAmelCase_    :     int            =	[
          """modeling_ctrl.py""",
          """modeling_tf_ctrl.py""",
      ]
      self.analyze_directory(__lowerCAmelCase  , identifier=__lowerCAmelCase  , ignore_files=__lowerCAmelCase			)




 def 	a   (			self							:			int			)->       Any:



      """simple docstring"""

      UpperCAmelCase_    :     Union[str, Any]            =	Path("""src/transformers"""			)
      UpperCAmelCase_    :     Tuple            =	"""tokenization"""
      self.analyze_directory(__lowerCAmelCase  , identifier=__lowerCAmelCase			)




 def 	a   (			self							:			List[Any]			)->       Any:



      """simple docstring"""

      UpperCAmelCase_    :     List[Any]            =	Path("""src/transformers"""			)
      UpperCAmelCase_    :     List[str]            =	"""configuration"""
      self.analyze_directory(__lowerCAmelCase  , identifier=__lowerCAmelCase			)




 def 	a   (			self							:			Any			)->       List[str]:



      """simple docstring"""

      UpperCAmelCase_    :     Tuple            =	Path("""src/transformers"""			)
      UpperCAmelCase_    :     int            =	["""configuration""", """modeling""", """tokenization"""]
      self.analyze_directory(__lowerCAmelCase  , n_identifier=__lowerCAmelCase			)






 def 	a   (			self							:			str			)->       Union[str, Any]:



      """simple docstring"""

      UpperCAmelCase_    :     Optional[int]            =	Path("""docs/source"""			)
      UpperCAmelCase_    :     Optional[Any]            =	["""favicon.ico"""]
      self.analyze_directory(__lowerCAmelCase  , ignore_files=__lowerCAmelCase  , only_modules=__lowerCAmelCase			)


"""simple docstring"""


from typing import TYPE_CHECKING

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


UpperCAmelCase__			=    {"""configuration_vit_mae""": ["""VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTMAEConfig"""]}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCAmelCase__			=    [
        """VIT_MAE_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """ViTMAEForPreTraining""",
        """ViTMAELayer""",
        """ViTMAEModel""",
        """ViTMAEPreTrainedModel""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    UpperCAmelCase__			=    [
        """TFViTMAEForPreTraining""",
        """TFViTMAEModel""",
        """TFViTMAEPreTrainedModel""",
    ]

if TYPE_CHECKING:
    from .configuration_vit_mae import VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP, ViTMAEConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_vit_mae import (
            VIT_MAE_PRETRAINED_MODEL_ARCHIVE_LIST,
            ViTMAEForPreTraining,
            ViTMAELayer,
            ViTMAEModel,
            ViTMAEPreTrainedModel,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_vit_mae import TFViTMAEForPreTraining, TFViTMAEModel, TFViTMAEPreTrainedModel


else:
    import sys

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