




import warnings

from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding






class        __lowerCAmelCase					(			UpperCAmelCase__					):
			snake_case_ :					List[str]						=	["image_processor", "tokenizer"]
			snake_case_ :					Tuple						=	"AutoImageProcessor"
			snake_case_ :					Optional[Any]						=	"AutoTokenizer"







			def __init__(			self       :     Tuple       ,       snake_case__       :     Tuple=None       ,       snake_case__       :     Optional[int]=None       ,       **snake_case__       :     Any ):




									"""simple docstring"""


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

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

									super().__init__(snake_case__       ,       snake_case__ )
									_UpperCAmelCase						=	self.image_processor







			def __call__(			self       :     Dict       ,       snake_case__       :     Tuple=None       ,       snake_case__       :     List[str]=None       ,       snake_case__       :     List[Any]=None       ,       **snake_case__       :     List[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:
															_UpperCAmelCase						=	self.tokenizer(snake_case__       ,       return_tensors=snake_case__       ,       **snake_case__ )

									if images is not None:
															_UpperCAmelCase						=	self.image_processor(snake_case__       ,       return_tensors=snake_case__       ,       **snake_case__ )

									if text is not None and images is not None:
															_UpperCAmelCase						=	image_features.pixel_values
															return encoding
									elif text is not None:
															return encoding
									else:
															return BatchEncoding(data=dict(**snake_case__ )       ,       tensor_type=snake_case__ )







			def UpperCamelCase     (			self       :     List[str]       ,       *snake_case__       :     List[str]       ,       **snake_case__       :     List[Any] ):




									"""simple docstring"""


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







			def UpperCamelCase     (			self       :     Dict       ,       *snake_case__       :     str       ,       **snake_case__       :     Tuple ):




									"""simple docstring"""


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







			@property
			def UpperCamelCase     (			self       :     Tuple ):




									"""simple docstring"""


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







			@property
			def UpperCamelCase     (			self       :     str ):




									"""simple docstring"""


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







			@property
			def UpperCamelCase     (			self       :     List[Any] ):




									"""simple docstring"""


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










def 				__SCREAMING_SNAKE_CASE    (     snake_case_		):

						'''simple docstring'''


						return int(snake_case_		) if x - int(snake_case_		) >= 0 else int(snake_case_		) - 1


if __name__ == "__main__":
				import doctest

				doctest.testmod()




