





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 :  Dict										=  logging.getLogger()



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





      def  __UpperCamelCase(				self ,							A_ ,							A_ = None ,							A_ = None ,							A_ = None ,							A_ = True ,							):
       '''simple docstring'''




       UpperCamelCase			:      Union[str, Any] 			=     [file for file in os.listdir(A_     ) if os.path.isfile(os.path.join(A_ ,							A_     )     )]

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

       if n_identifier is not None:
        if isinstance(A_ ,							A_     ):
         for n_ in n_identifier:
          UpperCamelCase			:      Any 			=     [file for file in files if n_ not in file]
        else:
         UpperCamelCase			:      Optional[int] 			=     [file for file in files if n_identifier not in file]

       UpperCamelCase			:      Dict 			=     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" ,							A_     )

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





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      int 			=     Path("src/transformers"     )
       UpperCamelCase			:      Dict 			=     "modeling"
       UpperCamelCase			:      Union[str, Any] 			=     [
           "modeling_ctrl.py",
           "modeling_tf_ctrl.py",
       ]
       self.analyze_directory(A_ ,							identifier=A_ ,							ignore_files=A_     )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      Tuple 			=     Path("src/transformers"     )
       UpperCamelCase			:      Tuple 			=     "tokenization"
       self.analyze_directory(A_ ,							identifier=A_     )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      Optional[Any] 			=     Path("src/transformers"     )
       UpperCamelCase			:      Optional[int] 			=     "configuration"
       self.analyze_directory(A_ ,							identifier=A_     )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      Optional[int] 			=     Path("src/transformers"     )
       UpperCamelCase			:      Union[str, Any] 			=     ["configuration", "modeling", "tokenization"]
       self.analyze_directory(A_ ,							n_identifier=A_     )





      def  __UpperCamelCase(				self     ):
       '''simple docstring'''




       UpperCamelCase			:      List[str] 			=     Path("docs/source"     )
       UpperCamelCase			:      Optional[Any] 			=     ["favicon.ico"]
       self.analyze_directory(A_ ,							ignore_files=A_ ,							only_modules=A_     )







from typing import TYPE_CHECKING

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


__lowerCamelCase :  Union[str, Any]										=  {
    """configuration_vision_encoder_decoder""": ["""VisionEncoderDecoderConfig""", """VisionEncoderDecoderOnnxConfig"""]
}

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase :  Dict										=  ["""VisionEncoderDecoderModel"""]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase :  List[str]										=  ["""TFVisionEncoderDecoderModel"""]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    __lowerCamelCase :  int										=  ["""FlaxVisionEncoderDecoderModel"""]

if TYPE_CHECKING:
    from .configuration_vision_encoder_decoder import VisionEncoderDecoderConfig, VisionEncoderDecoderOnnxConfig

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_vision_encoder_decoder import VisionEncoderDecoderModel

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_vision_encoder_decoder import TFVisionEncoderDecoderModel

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_vision_encoder_decoder import FlaxVisionEncoderDecoderModel

else:
    import sys

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