




'''simple docstring'''





import warnings
from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType




class  _snake_case		(	lowercase_							):
			lowerCAmelCase_     :      Tuple						       =    ["image_processor", "tokenizer"]
			lowerCAmelCase_     :      Any						       =    "FlavaImageProcessor"
			lowerCAmelCase_     :      Dict						       =    ("BertTokenizer", "BertTokenizerFast")




			def __init__(					self				,							a__=None				,							a__=None				,							**a__							)				->				int:

										'''simple docstring'''




										snake_case_						=      None
										if "feature_extractor" in kwargs:
																	warnings.warn(
																	    "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
																	    " instead."				,							a__				,							)
																	snake_case_						=      kwargs.pop("feature_extractor"							)

										snake_case_						=      image_processor if image_processor is not None else feature_extractor
										if image_processor is None:
																	raise ValueError("You need to specify an `image_processor`."							)
										if tokenizer is None:
																	raise ValueError("You need to specify a `tokenizer`."							)

										super().__init__(a__				,							a__							)
										snake_case_						=      self.image_processor




			def __call__(					self				,							a__ = None				,							a__ = None				,							a__ = True				,							a__ = False				,							a__ = False				,							a__ = None				,							a__ = 0				,							a__ = None				,							a__ = None				,							a__ = None				,							a__ = None				,							a__ = None				,							a__ = False				,							a__ = False				,							a__ = False				,							a__ = False				,							a__ = True				,							a__ = None				,							**a__				,							)				->				Optional[Any]:

										'''simple docstring'''




										if text is None and images is None:
																	raise ValueError("You have to specify either text or images. Both cannot be none."							)

										if text is not None:
																	snake_case_						=      self.tokenizer(
																	    text=a__				,							add_special_tokens=a__				,							padding=a__				,							truncation=a__				,							max_length=a__				,							stride=a__				,							pad_to_multiple_of=a__				,							return_token_type_ids=a__				,							return_attention_mask=a__				,							return_overflowing_tokens=a__				,							return_special_tokens_mask=a__				,							return_offsets_mapping=a__				,							return_length=a__				,							verbose=a__				,							return_tensors=a__				,							**a__				,							)
										if images is not None:
																	snake_case_						=      self.image_processor(
																	    a__				,							return_image_mask=a__				,							return_codebook_pixels=a__				,							return_tensors=a__				,							**a__				,							)

										if text is not None and images is not None:
																	encoding.update(a__							)
																	return encoding
										elif text is not None:
																	return encoding
										else:
																	return BatchEncoding(data=dict(**a__							)				,							tensor_type=a__							)




			def    lowerCAmelCase__				(					self				,							*a__				,							**a__							)				->				Any:

										'''simple docstring'''




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




			def    lowerCAmelCase__				(					self				,							*a__				,							**a__							)				->				Dict:

										'''simple docstring'''




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




			@property
			def    lowerCAmelCase__				(					self							)				->				Union[str, Any]:

										'''simple docstring'''




										snake_case_						=      self.tokenizer.model_input_names
										snake_case_						=      self.image_processor.model_input_names
										return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names							)							)




			@property
			def    lowerCAmelCase__				(					self							)				->				Tuple:

										'''simple docstring'''




										warnings.warn(
										    "`feature_extractor_class` is deprecated and will be removed in v5. Use `image_processor_class` instead."				,							a__				,							)
										return self.image_processor_class




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

										'''simple docstring'''




										warnings.warn(
										    "`feature_extractor` is deprecated and will be removed in v5. Use `image_processor` instead."				,							a__				,							)
										return self.image_processor








'''simple docstring'''

from __future__ import annotations

def _SCREAMING_SNAKE_CASE      (A       )       ->       bool:






       """simple docstring"""







       return len(set(A       )       ) == len(A       )


if __name__ == "__main__":
 import doctest

 doctest.testmod()




