"""simple docstring"""

import warnings
from contextlib import contextmanager

from ...processing_utils import ProcessorMixin






class 		_lowercase (						SCREAMING_SNAKE_CASE_      ):



						"""simple docstring"""




						lowercase__       =  ["""image_processor""", """tokenizer"""]
						lowercase__       =  """AutoImageProcessor"""
						lowercase__       =  """AutoTokenizer"""





						def __init__(				self							:    str     , UpperCamelCase__							:    str=None     , UpperCamelCase__							:    int=None     , **UpperCamelCase__							:    int				)				->				List[str]:
													'''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.'''     , __UpperCAmelCase     , )
																				__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 need to specify an `image_processor`.'''				)
													if tokenizer is None:
																				raise ValueError('''You need to specify a `tokenizer`.'''				)

													super().__init__(__UpperCAmelCase     , __UpperCAmelCase				)
													__UpperCamelCase							=self.image_processor
													__UpperCamelCase							=False





						def __call__(				self							:    Dict     , *UpperCamelCase__							:    Tuple     , **UpperCamelCase__							:    str				)				->				Any:
													'''simple docstring'''



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

													__UpperCamelCase							=kwargs.pop('''images'''     , __UpperCAmelCase				)
													__UpperCamelCase							=kwargs.pop('''text'''     , __UpperCAmelCase				)
													if len(__UpperCAmelCase				) > 0:
																				__UpperCamelCase							=args[0]
																				__UpperCamelCase							=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:
																				__UpperCamelCase							=self.image_processor(__UpperCAmelCase     , *__UpperCAmelCase     , **__UpperCAmelCase				)
													if text is not None:
																				__UpperCamelCase							=self.tokenizer(__UpperCAmelCase     , **__UpperCAmelCase				)

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





						def   UpperCAmelCase_ (				self							:    Tuple     , *UpperCamelCase__							:    Any     , **UpperCamelCase__							:    Union[str, Any]				)				->				List[str]:
													'''simple docstring'''



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





						def   UpperCAmelCase_ (				self							:    List[Any]     , *UpperCamelCase__							:    Tuple     , **UpperCamelCase__							:    Optional[Any]				)				->				Tuple:
													'''simple docstring'''



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





						@contextmanager
						def   UpperCAmelCase_ (				self							:    Tuple				)				->				Dict:
													'''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.'''				)
													__UpperCamelCase							=True
													__UpperCamelCase							=self.tokenizer
													yield
													__UpperCamelCase							=self.image_processor
													__UpperCamelCase							=False





						@property
						def   UpperCAmelCase_ (				self							:    Optional[Any]				)				->				str:
													'''simple docstring'''



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





						@property
						def   UpperCAmelCase_ (				self							:    Union[str, Any]				)				->				List[str]:
													'''simple docstring'''



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





"""simple docstring"""






from collections import namedtuple

UpperCamelCase_						   =   namedtuple('from_to', 'from_ to')

UpperCamelCase_						   =   {
    'atm': from_to(1, 1),
    'pascal': from_to(0.0_00_00_98, 101325),
    'bar': from_to(0.98_69_23, 1.0_13_25),
    'kilopascal': from_to(0.00_98_69_23, 1_01.3_25),
    'megapascal': from_to(9.8_69_23, 0.10_13_25),
    'psi': from_to(0.06_80_46, 14.69_59),
    'inHg': from_to(0.0_33_42_11, 29.92_13),
    'torr': from_to(0.00_13_15_79, 760),
}
def    UpperCamelCase						(					UpperCAmelCase ,   UpperCAmelCase ,   UpperCAmelCase     )						->float:

   """simple docstring"""



   if from_type not in PRESSURE_CONVERSION:
      raise ValueError(
          F'''Invalid \'from_type\' value: {from_type!r}  Supported values are:\n'''
          + ", ".join(UpperCAmelCase     )     )
   if to_type not in PRESSURE_CONVERSION:
      raise ValueError(
          F'''Invalid \'to_type\' value: {to_type!r}.  Supported values are:\n'''
          + ", ".join(UpperCAmelCase     )     )
   return (
       value * PRESSURE_CONVERSION[from_type].from_ * PRESSURE_CONVERSION[to_type].to
   )


if __name__ == "__main__":
      import doctest

      doctest.testmod()