



'''simple docstring'''







import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin




class 				__lowerCAmelCase(							lowerCAmelCase__      ):
			__snake_case  :		List[str]		=      ['image_processor', 'tokenizer']
			__snake_case  :		Tuple		=      'AutoImageProcessor'
			__snake_case  :		str		=      'AutoTokenizer'






			def __init__(   self  :							List[str]      ,       SCREAMING_SNAKE_CASE  :							Optional[Any]=None      ,       SCREAMING_SNAKE_CASE  :							List[str]=None      ,       **SCREAMING_SNAKE_CASE  :							str	):




					"""simple docstring"""







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

					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      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__(SCREAMING_SNAKE_CASE      ,       SCREAMING_SNAKE_CASE	)
					SCREAMING_SNAKE_CASE_						:Tuple										=      self.image_processor
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      False






			def __call__(   self  :							Optional[Any]      ,       *SCREAMING_SNAKE_CASE  :							Union[str, Any]      ,       **SCREAMING_SNAKE_CASE  :							Tuple	):




					"""simple docstring"""







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

					SCREAMING_SNAKE_CASE_						:str										=      kwargs.pop('images'      ,       SCREAMING_SNAKE_CASE	)
					SCREAMING_SNAKE_CASE_						:str										=      kwargs.pop('text'      ,       SCREAMING_SNAKE_CASE	)
					if len(SCREAMING_SNAKE_CASE	) > 0:
							SCREAMING_SNAKE_CASE_						:Optional[Any]										=      args[0]
							SCREAMING_SNAKE_CASE_						:Optional[int]										=      args[1:]

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

					if images is not None:
							SCREAMING_SNAKE_CASE_						:Tuple										=      self.image_processor(SCREAMING_SNAKE_CASE      ,       *SCREAMING_SNAKE_CASE      ,       **SCREAMING_SNAKE_CASE	)
					if text is not None:
							SCREAMING_SNAKE_CASE_						:int										=      self.tokenizer(SCREAMING_SNAKE_CASE      ,       **SCREAMING_SNAKE_CASE	)

					if text is None:
							return inputs
					elif images is None:
							return encodings
					else:
							SCREAMING_SNAKE_CASE_						:int										=      encodings['input_ids']
							return inputs






			def 				_lowercase	(   self  :							Dict      ,       *SCREAMING_SNAKE_CASE  :							Dict      ,       **SCREAMING_SNAKE_CASE  :							Any	):




					"""simple docstring"""







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






			def 				_lowercase	(   self  :							Optional[Any]      ,       *SCREAMING_SNAKE_CASE  :							str      ,       **SCREAMING_SNAKE_CASE  :							Optional[int]	):




					"""simple docstring"""







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






			@contextmanager
			def 				_lowercase	(   self  :							Optional[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 images inputs, or in a separate call.'	)
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      True
					SCREAMING_SNAKE_CASE_						:str										=      self.tokenizer
					yield
					SCREAMING_SNAKE_CASE_						:int										=      self.image_processor
					SCREAMING_SNAKE_CASE_						:int										=      False






			@property
			def 				_lowercase	(   self  :							Union[str, Any]	):




					"""simple docstring"""







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






			@property
			def 				_lowercase	(   self  :							Dict	):




					"""simple docstring"""







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





'''simple docstring'''







import warnings

from ...utils import logging
from .image_processing_maskformer import MaskFormerImageProcessor


SCREAMING_SNAKE_CASE__     : Dict				=   logging.get_logger(__name__)




class 				__lowerCAmelCase(							lowerCAmelCase__      ):






			def __init__(   self  :							List[Any]      ,       *SCREAMING_SNAKE_CASE  :							int      ,       **SCREAMING_SNAKE_CASE  :							Optional[int]	):




					"""simple docstring"""







					warnings.warn(
					    'The class MaskFormerFeatureExtractor is deprecated and will be removed in version 5 of Transformers.'
					    ' Please use MaskFormerImageProcessor instead.'      ,       SCREAMING_SNAKE_CASE      ,       )
					super().__init__(*SCREAMING_SNAKE_CASE      ,       **SCREAMING_SNAKE_CASE	)
