
"""simple docstring"""




import warnings

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




class      UpperCamelCase	(       __magic_name__      ):

				"""simple docstring"""



				UpperCAmelCase_				:      Dict						  =				["image_processor", "tokenizer"]
				UpperCAmelCase_				:      str						  =				"VideoMAEImageProcessor"
				UpperCAmelCase_				:      List[str]						  =				("CLIPTokenizer", "CLIPTokenizerFast")


				def __init__(				self		,	lowercase__=None		,	lowercase__=None		,	**lowercase__			)    ->    str:
									"""simple docstring"""







									SCREAMING_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.'		,	lowercase__		,	)
														SCREAMING_SNAKE_CASE				=	kwargs.pop('feature_extractor'			)

									SCREAMING_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__(lowercase__		,	lowercase__			)
									SCREAMING_SNAKE_CASE				=	self.image_processor


				def __call__(				self		,	lowercase__=None		,	lowercase__=None		,	lowercase__=None		,	**lowercase__			)    ->    Any:
									"""simple docstring"""







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

									if text is not None:
														SCREAMING_SNAKE_CASE				=	self.tokenizer(lowercase__		,	return_tensors=lowercase__		,	**lowercase__			)

									if videos is not None:
														SCREAMING_SNAKE_CASE				=	self.image_processor(lowercase__		,	return_tensors=lowercase__		,	**lowercase__			)

									if text is not None and videos is not None:
														SCREAMING_SNAKE_CASE				=	image_features.pixel_values
														return encoding
									elif text is not None:
														return encoding
									else:
														return BatchEncoding(data=dict(**lowercase__			)		,	tensor_type=lowercase__			)


				def 							A					(				self		,	*lowercase__		,	**lowercase__			)    ->    List[str]:
									"""simple docstring"""







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


				def 							A					(				self		,	*lowercase__		,	**lowercase__			)    ->    int:
									"""simple docstring"""







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


				@property
				def 							A					(				self			)    ->    Union[str, Any]:
									"""simple docstring"""







									return ["input_ids", "attention_mask", "position_ids", "pixel_values"]


				@property
				def 							A					(				self			)    ->    Union[str, Any]:
									"""simple docstring"""







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




				@property
				def 							A					(				self			)    ->    int:
									"""simple docstring"""







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


"""simple docstring"""




# Lint as: python3

import hashlib
from typing import Union

def   UpperCamelCase_  (		SCREAMING_SNAKE_CASE_			):
					if isinstance(SCREAMING_SNAKE_CASE_,     SCREAMING_SNAKE_CASE_			):
										# Data already in bytes, returns as it as
										return hash_data
					elif isinstance(SCREAMING_SNAKE_CASE_,     SCREAMING_SNAKE_CASE_			):
										# We keep the data as it as for it ot be later encoded to UTF-8
										# However replace `\\` with `/` for Windows compatibility
										SCREAMING_SNAKE_CASE				=	hash_data.replace('\\',     '/'			)
					elif isinstance(SCREAMING_SNAKE_CASE_,     SCREAMING_SNAKE_CASE_			):
										SCREAMING_SNAKE_CASE				=	str(SCREAMING_SNAKE_CASE_			)
					else:
										# If data is not of the required type, raise error
										raise InvalidKeyError(SCREAMING_SNAKE_CASE_			)

					return hash_data.encode('utf-8'			)




class      UpperCamelCase	(       __magic_name__      ):

				"""simple docstring"""



				def __init__(				self		,	lowercase__			)    ->    Dict:
									"""simple docstring"""







									SCREAMING_SNAKE_CASE				=	'\nFAILURE TO GENERATE DATASET: Invalid key type detected'
									SCREAMING_SNAKE_CASE				=	f'''\nFound Key {hash_data} of type {type(lowercase__			)}'''
									SCREAMING_SNAKE_CASE				=	'\nKeys should be either str, int or bytes type'
									super().__init__(f'''{self.prefix}{self.err_msg}{self.suffix}'''			)






class      UpperCamelCase	(       __magic_name__      ):

				"""simple docstring"""



				def __init__(				self		,	lowercase__		,	lowercase__		,	lowercase__=""			)    ->    Tuple:
									"""simple docstring"""







									SCREAMING_SNAKE_CASE				=	key
									SCREAMING_SNAKE_CASE				=	duplicate_key_indices
									SCREAMING_SNAKE_CASE				=	fix_msg
									SCREAMING_SNAKE_CASE				=	'Found multiple examples generated with the same key'
									if len(lowercase__			) <= 20:
														SCREAMING_SNAKE_CASE				=	f'''\nThe examples at index {', '.join(lowercase__			)} have the key {key}'''
									else:
														SCREAMING_SNAKE_CASE				=	f'''\nThe examples at index {', '.join(duplicate_key_indices[:20]			)}... ({len(lowercase__			) - 20} more) have the key {key}'''
									SCREAMING_SNAKE_CASE				=	'\n' + fix_msg if fix_msg else ''
									super().__init__(f'''{self.prefix}{self.err_msg}{self.suffix}'''			)






class      UpperCamelCase	:

				"""simple docstring"""



				def __init__(				self		,	lowercase__			)    ->    Union[str, Any]:
									"""simple docstring"""







									SCREAMING_SNAKE_CASE				=	hashlib.mda(_as_bytes(lowercase__			)			)




				def 							A					(				self		,	lowercase__			)    ->    int:
									"""simple docstring"""







									SCREAMING_SNAKE_CASE				=	self._split_mda.copy()
									SCREAMING_SNAKE_CASE				=	_as_bytes(lowercase__			)
									mda.update(lowercase__			)
									# Convert to integer with hexadecimal conversion
									return int(mda.hexdigest()		,	16			)
