


'''simple docstring'''







import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin


class  lowerCAmelCase_						(       snake_case__      ):





  """simple docstring"""



  a_       :Tuple												="""MCTCTFeatureExtractor"""
  a_       :int												="""AutoTokenizer"""

  def __init__(					self     :							List[Any]				,							SCREAMING_SNAKE_CASE__     :							Tuple				,							SCREAMING_SNAKE_CASE__     :							int						):





       '''simple docstring'''

       super().__init__(SCREAMING_SNAKE_CASE__				,							SCREAMING_SNAKE_CASE__						)
       __a       =   self.feature_extractor
       __a       =   False

  def __call__(					self     :							Tuple				,							*SCREAMING_SNAKE_CASE__     :							Union[str, Any]				,							**SCREAMING_SNAKE_CASE__     :							str						):





       '''simple docstring'''

       if self._in_target_context_manager:
            return self.current_processor(*SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)

       if "raw_speech" in kwargs:
            warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""						)
            __a       =   kwargs.pop("""raw_speech"""						)
       else:
            __a       =   kwargs.pop("""audio"""				,							SCREAMING_SNAKE_CASE__						)
       __a       =   kwargs.pop("""sampling_rate"""				,							SCREAMING_SNAKE_CASE__						)
       __a       =   kwargs.pop("""text"""				,							SCREAMING_SNAKE_CASE__						)
       if len(SCREAMING_SNAKE_CASE__						) > 0:
            __a       =   args[0]
            __a       =   args[1:]

       if audio is None and text is None:
            raise ValueError("""You need to specify either an `audio` or `text` input to process."""						)

       if audio is not None:
            __a       =   self.feature_extractor(SCREAMING_SNAKE_CASE__				,							*SCREAMING_SNAKE_CASE__				,							sampling_rate=SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)
       if text is not None:
            __a       =   self.tokenizer(SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)

       if text is None:
            return inputs
       elif audio is None:
            return encodings
       else:
            __a       =   encodings["""input_ids"""]
            return inputs

  def __a						(					self     :							List[Any]				,							*SCREAMING_SNAKE_CASE__     :							Optional[int]				,							**SCREAMING_SNAKE_CASE__     :							List[Any]						):





       '''simple docstring'''

       return self.tokenizer.batch_decode(*SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)

  def __a						(					self     :							List[str]				,							*SCREAMING_SNAKE_CASE__     :							str				,							**SCREAMING_SNAKE_CASE__     :							List[Any]						):





       '''simple docstring'''

       if self._in_target_context_manager:
            return self.current_processor.pad(*SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)

       __a       =   kwargs.pop("""input_features"""				,							SCREAMING_SNAKE_CASE__						)
       __a       =   kwargs.pop("""labels"""				,							SCREAMING_SNAKE_CASE__						)
       if len(SCREAMING_SNAKE_CASE__						) > 0:
            __a       =   args[0]
            __a       =   args[1:]

       if input_features is not None:
            __a       =   self.feature_extractor.pad(SCREAMING_SNAKE_CASE__				,							*SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)
       if labels is not None:
            __a       =   self.tokenizer.pad(SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)

       if labels is None:
            return input_features
       elif input_features is None:
            return labels
       else:
            __a       =   labels["""input_ids"""]
            return input_features

  def __a						(					self     :							Tuple				,							*SCREAMING_SNAKE_CASE__     :							int				,							**SCREAMING_SNAKE_CASE__     :							List[Any]						):





       '''simple docstring'''

       return self.tokenizer.decode(*SCREAMING_SNAKE_CASE__				,							**SCREAMING_SNAKE_CASE__						)


  @contextmanager
  def __a						(					self     :							Any						):





       '''simple docstring'''

       warnings.warn(
           """`as_target_processor` is deprecated and will be removed in v5 of Transformers. You can process your """
           """labels by using the argument `text` of the regular `__call__` method (either in the same call as """
           """your audio inputs, or in a separate call."""						)
       __a       =   True
       __a       =   self.tokenizer
       yield
       __a       =   self.feature_extractor
       __a       =   False










'''simple docstring'''







from __future__ import annotations




def        __lowercase						(      __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE				,  __SCREAMING_SNAKE_CASE				,  )				->					tuple[str, float]:
     """simple docstring"""




     if (stress, tangential_force, area).count(0		) != 1:
          raise ValueError("""You cannot supply more or less than 2 values"""		)
     elif stress < 0:
          raise ValueError("""Stress cannot be negative"""		)
     elif tangential_force < 0:
          raise ValueError("""Tangential Force cannot be negative"""		)
     elif area < 0:
          raise ValueError("""Area cannot be negative"""		)
     elif stress == 0:
          return (
              "stress",
              tangential_force / area,
          )
     elif tangential_force == 0:
          return (
              "tangential_force",
              stress * area,
          )
     else:
          return (
              "area",
              tangential_force / stress,
          )


if __name__ == "__main__":
 import doctest

 doctest.testmod()






