

'''simple docstring'''







from ...processing_utils import ProcessorMixin


class        A__   (   _snake_case      ):
    lowercase						       =		["image_processor", "feature_extractor"]
    lowercase						       =		"TvltImageProcessor"
    lowercase						       =		"TvltFeatureExtractor"



    def __init__(       self		,					UpperCamelCase__		,					UpperCamelCase__							)    ->   Optional[int]:





           '''simple docstring'''
           super().__init__(image_processor=UpperCamelCase__		,					feature_extractor=UpperCamelCase__							)

           A_						       =   image_processor
           A_						       =   feature_extractor



    def __call__(       self		,					UpperCamelCase__=None		,					UpperCamelCase__=None		,					UpperCamelCase__=None		,					UpperCamelCase__=None		,					UpperCamelCase__=False		,					UpperCamelCase__=False		,					*UpperCamelCase__		,					**UpperCamelCase__		,					)    ->   List[Any]:





           '''simple docstring'''

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

           A_						       =   None
           if images is not None:
                  A_						       =   self.image_processor(UpperCamelCase__		,					mask_pixel=UpperCamelCase__		,					*UpperCamelCase__		,					**UpperCamelCase__							)
           if images_mixed is not None:
                  A_						       =   self.image_processor(UpperCamelCase__		,					is_mixed=UpperCamelCase__		,					*UpperCamelCase__		,					**UpperCamelCase__							)
           if audio is not None:
                  A_						       =   self.feature_extractor(
                      UpperCamelCase__		,					*UpperCamelCase__		,					sampling_rate=UpperCamelCase__		,					mask_audio=UpperCamelCase__		,					**UpperCamelCase__							)

           A_						       =   {}
           if audio is not None:
                  output_dict.update(UpperCamelCase__							)
           if images is not None:
                  output_dict.update(UpperCamelCase__							)
           if images_mixed_dict is not None:
                  output_dict.update(UpperCamelCase__							)
           return output_dict







    @property
    def        snake_case_      (       self							)    ->   List[Any]:





           '''simple docstring'''
           A_						       =   self.image_processor.model_input_names
           A_						       =   self.feature_extractor.model_input_names
           return list(dict.fromkeys(image_processor_input_names + feature_extractor_input_names							)							)



'''simple docstring'''







import pytest

import datasets


# Import fixture modules as plugins
__lowerCamelCase									=     ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec''']
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      Optional[int]:
       # Mark tests as "unit" by default if not marked as "integration" (or already marked as "unit")
       for item in items:
              if any(marker in item.keywords for marker in ["""integration""", """unit"""]					):
                     continue
              item.add_marker(pytest.mark.unit					)
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Tuple:
       config.addinivalue_line("""markers""",							"""torchaudio_latest: mark test to run with torchaudio>=0.12"""					)
@pytest.fixture(autouse=UpperCAmelCase__					)
def    UpperCAmelCase__     (   UpperCAmelCase__,							UpperCAmelCase__					)      ->      int:
       # test_hf_cache_home = tmp_path_factory.mktemp("cache")  # TODO: why a cache dir per test function does not work?
       A_						       =   tmp_path_factory.getbasetemp() / """cache"""
       A_						       =   test_hf_cache_home / """datasets"""
       A_						       =   test_hf_cache_home / """metrics"""
       A_						       =   test_hf_cache_home / """modules"""
       monkeypatch.setattr("""datasets.config.HF_DATASETS_CACHE""",							str(UpperCAmelCase__					)					)
       monkeypatch.setattr("""datasets.config.HF_METRICS_CACHE""",							str(UpperCAmelCase__					)					)
       monkeypatch.setattr("""datasets.config.HF_MODULES_CACHE""",							str(UpperCAmelCase__					)					)
       A_						       =   test_hf_datasets_cache / """downloads"""
       monkeypatch.setattr("""datasets.config.DOWNLOADED_DATASETS_PATH""",							str(UpperCAmelCase__					)					)
       A_						       =   test_hf_datasets_cache / """downloads""" / """extracted"""
       monkeypatch.setattr("""datasets.config.EXTRACTED_DATASETS_PATH""",							str(UpperCAmelCase__					)					)
@pytest.fixture(autouse=UpperCAmelCase__,							scope="""session"""					)
def    UpperCAmelCase__     (   )      ->      str:
       datasets.disable_progress_bar()
@pytest.fixture(autouse=UpperCAmelCase__					)
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Tuple:
       # don't take tests into account when counting downloads
       monkeypatch.setattr("""datasets.config.HF_UPDATE_DOWNLOAD_COUNTS""",							UpperCAmelCase__					)







@pytest.fixture
def    UpperCAmelCase__     (   UpperCAmelCase__					)      ->      Any:
       # Required to suppress RemovedIn20Warning when feature(s) are not compatible with SQLAlchemy 2.0
       # To be removed once SQLAlchemy 2.0 supported
       monkeypatch.setattr("""sqlalchemy.util.deprecations.SILENCE_UBER_WARNING""",							UpperCAmelCase__					)
