





import warnings
from contextlib import contextmanager

from ....processing_utils import ProcessorMixin




class 	UpperCamelCase_							(  __lowerCamelCase     ):
							lowerCamelCase_							     =       'MCTCTFeatureExtractor'
							lowerCamelCase_							     =       'AutoTokenizer'


							def __init__(				self     :Dict				,					__A     :Tuple				,					__A     :Optional[int]		) -> List[Any]:



									"""simple docstring"""



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


							def __call__(				self     :Union[str, Any]				,					*__A     :str				,					**__A     :List[str]		) -> Dict:



									"""simple docstring"""



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

									if "raw_speech" in kwargs:
											warnings.warn("""Using `raw_speech` as a keyword argument is deprecated. Use `audio` instead."""		)
											SCREAMING_SNAKE_CASE__								=   kwargs.pop("""raw_speech"""		)
									else:
											SCREAMING_SNAKE_CASE__								=   kwargs.pop("""audio"""				,					lowerCamelCase__		)
									SCREAMING_SNAKE_CASE__								=   kwargs.pop("""sampling_rate"""				,					lowerCamelCase__		)
									SCREAMING_SNAKE_CASE__								=   kwargs.pop("""text"""				,					lowerCamelCase__		)
									if len(lowerCamelCase__		) > 0:
											SCREAMING_SNAKE_CASE__								=   args[0]
											SCREAMING_SNAKE_CASE__								=   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:
											SCREAMING_SNAKE_CASE__								=   self.feature_extractor(lowerCamelCase__				,					*lowerCamelCase__				,					sampling_rate=lowerCamelCase__				,					**lowerCamelCase__		)
									if text is not None:
											SCREAMING_SNAKE_CASE__								=   self.tokenizer(lowerCamelCase__				,					**lowerCamelCase__		)

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


							def   _snake_case	(				self     :Union[str, Any]				,					*__A     :Union[str, Any]				,					**__A     :Tuple		) -> Any:



									"""simple docstring"""



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


							def   _snake_case	(				self     :Optional[Any]				,					*__A     :Any				,					**__A     :Optional[int]		) -> List[str]:



									"""simple docstring"""



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

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

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

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


							def   _snake_case	(				self     :Any				,					*__A     :Any				,					**__A     :Union[str, Any]		) -> Optional[Any]:



									"""simple docstring"""



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


							@contextmanager
							def   _snake_case	(				self     :List[str]		) -> List[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."""		)
									SCREAMING_SNAKE_CASE__								=   True
									SCREAMING_SNAKE_CASE__								=   self.tokenizer
									yield
									SCREAMING_SNAKE_CASE__								=   self.feature_extractor
									SCREAMING_SNAKE_CASE__								=   False


# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.:
#   python ./utils/get_modified_files.py utils src tests examples
#
# it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered
# since the output of this script is fed into Makefile commands it doesn't print a newline after the results

import re
import subprocess
import sys


__lowercase				      =						subprocess.check_output("""git merge-base main HEAD""".split()).decode("""utf-8""")
__lowercase				      =						(
    subprocess.check_output(f'git diff --diff-filter=d --name-only {fork_point_sha}'.split()).decode("""utf-8""").split()
)

__lowercase				      =						"""|""".join(sys.argv[1:])
__lowercase				      =						re.compile(rf'^({joined_dirs}).*?\.py$')

__lowercase				      =						[x for x in modified_files if regex.match(x)]
print(""" """.join(relevant_modified_files), end="""""")





