
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):
      def 						UpperCamelCase__							(      self    ,  __magic_name__    ,  __magic_name__ = None    ,  __magic_name__ = None    ,  __magic_name__ = None    ,  __magic_name__ = True    ,  ):
       lowerCamelCase		:	Any							=      [file for file in os.listdir(__magic_name__      ) if os.path.isfile(os.path.join(__magic_name__    ,  __magic_name__      )      )]

       if identifier is not None:
        lowerCamelCase		:	List[str]							=      [file for file in files if identifier in file]

       if n_identifier is not None:
        if isinstance(__magic_name__    ,  __magic_name__      ):
         for n_ in n_identifier:
          lowerCamelCase		:	Any							=      [file for file in files if n_ not in file]
        else:
         lowerCamelCase		:	Union[str, Any]							=      [file for file in files if n_identifier not in file]

       lowerCamelCase		:	Any							=      ignore_files or []
       ignore_files.append("""__init__.py"""      )
       lowerCamelCase		:	Dict							=      [file for file in files if file not in ignore_files]

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

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






      def 						UpperCamelCase__							(      self      ):
       lowerCamelCase		:	Union[str, Any]							=      Path("""docs/source"""      )
       lowerCamelCase		:	Tuple							=      ["""favicon.ico"""]
       self.analyze_directory(__magic_name__    ,  ignore_files=__magic_name__    ,  only_modules=__magic_name__      )






import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate





@dataclass(frozen=__SCREAMING_SNAKE_CASE)
class 							A__		(	__SCREAMING_SNAKE_CASE):
      _UpperCAmelCase				:    str           =			field(default="""automatic-speech-recognition"""  ,   metadata={"""include_in_asdict_even_if_is_default""": True})
      _UpperCAmelCase				:    ClassVar[Features]           =			Features({"""audio""": Audio()})
      _UpperCAmelCase				:    ClassVar[Features]           =			Features({"""transcription""": Value("""string""")})
      _UpperCAmelCase				:    str           =			"audio"
      _UpperCAmelCase				:    str           =			"transcription"
      def 						UpperCamelCase__							(      self    ,  __magic_name__      ):
       if self.audio_column not in features:
        raise ValueError(F'''Column {self.audio_column} is not present in features.'''      )
       if not isinstance(features[self.audio_column]    ,  __magic_name__      ):
        raise ValueError(F'''Column {self.audio_column} is not an Audio type.'''      )
       lowerCamelCase		:	Optional[Any]							=      copy.deepcopy(self      )
       lowerCamelCase		:	List[Any]							=      self.input_schema.copy()
       lowerCamelCase		:	Tuple							=      features[self.audio_column]
       lowerCamelCase		:	int							=      input_schema
       return task_template






      @property
      def 						UpperCamelCase__							(      self      ):
       return {self.audio_column: "audio", self.transcription_column: "transcription"}




