





'''simple docstring'''




import enum
import shutil
import sys


lowercase__   :				Any      =   shutil.get_terminal_size()

lowercase__   :				Union[str, Any]      =   {'''UP''': '''A''', '''DOWN''': '''B''', '''RIGHT''': '''C''', '''LEFT''': '''D'''}


class 			SCREAMING_SNAKE_CASE   (enum.Enum							):
     lowerCAmelCase		      =	0
     lowerCAmelCase		      =	1






def 	_lowerCAmelCase      (  __snake_case  :			Optional[int]			,							__snake_case  :			str=""      )					->					Optional[Any]:






     """simple docstring"""




     sys.stdout.write(str(__snake_case      ) + end      )
     sys.stdout.flush()






def 	_lowerCAmelCase      (  __snake_case  :			Optional[int]			,							__snake_case  :			Dict			,							__snake_case  :			Union[str, Any]=""      )					->					List[str]:






     """simple docstring"""




     forceWrite(f'\u001b[{color}m{content}\u001b[0m'			,							__snake_case      )






def 	_lowerCAmelCase      (  )					->					Any:






     """simple docstring"""




     forceWrite('\r'      )






def 	_lowerCAmelCase      (  __snake_case  :			int			,							__snake_case  :			str      )					->					Optional[Any]:






     """simple docstring"""




     forceWrite(f'\033[{num_lines}{CURSOR_TO_CHAR[direction.upper()]}'      )






def 	_lowerCAmelCase      (  )					->					Optional[Any]:






     """simple docstring"""




     forceWrite(' ' * TERMINAL_WIDTH      )
     reset_cursor()







def 	_lowerCAmelCase      (  )					->					Any:






     """simple docstring"""




     reset_cursor()
     forceWrite('-' * TERMINAL_WIDTH      )






'''simple docstring'''




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


class 			SCREAMING_SNAKE_CASE   (a__							):
     lowerCAmelCase		      =	['''image_processor''', '''tokenizer''']
     lowerCAmelCase		      =	'''AutoImageProcessor'''
     lowerCAmelCase		      =	'''AutoTokenizer'''


     def __init__(						self						,     _UpperCAmelCase						,     _UpperCAmelCase):

          '''simple docstring'''






          super().__init__(_UpperCAmelCase						,     _UpperCAmelCase)
          __A						:			Tuple								=	self.image_processor


     def __call__(						self						,     _UpperCAmelCase=None						,     _UpperCAmelCase=None						,     _UpperCAmelCase=None						,     **_UpperCAmelCase):

          '''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:
               __A						:			Any								=	self.tokenizer(_UpperCAmelCase						,     return_tensors=_UpperCAmelCase						,     **_UpperCAmelCase)

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

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


     def 							SCREAMING_SNAKE_CASE  (						self						,     *_UpperCAmelCase						,     **_UpperCAmelCase):

          '''simple docstring'''






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


     def 							SCREAMING_SNAKE_CASE  (						self						,     *_UpperCAmelCase						,     **_UpperCAmelCase):

          '''simple docstring'''






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


     @property
     def 							SCREAMING_SNAKE_CASE  (						self):

          '''simple docstring'''






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