






"""simple docstring"""





import warnings

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


class   _lowercase			(  _snake_case    ):
      _a :  List[str]										= ['''image_processor''', '''tokenizer''']
      _a :  Dict										= '''AutoImageProcessor'''
      _a :  int										= '''AutoTokenizer'''


      def __init__(     self					:						List[str]				, a					:						str=None				, a					:						str=None				, **a					:						Union[str, Any]    ):





            """simple docstring"""







            __snake_case   :     Any	      =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__				, )
                  __snake_case   :     Any	      =kwargs.pop('''feature_extractor'''    )

            __snake_case   :     List[Any]	      =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__(lowercase__				, lowercase__    )
            __snake_case   :     Any	      =self.image_processor


      def __call__(     self					:						Union[str, Any]				, a					:						Dict=None				, a					:						Optional[int]=None				, a					:						Dict=None				, **a					:						List[str]    ):





            """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:
                  __snake_case   :     Optional[int]	      =self.tokenizer(lowercase__				, return_tensors=lowercase__				, **lowercase__    )

            if images is not None:
                  __snake_case   :     str	      =self.image_processor(lowercase__				, return_tensors=lowercase__				, **lowercase__    )

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


      def _UpperCamelCase    (     self					:						List[str]				, *a					:						List[Any]				, **a					:						Dict    ):





            """simple docstring"""







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


      def _UpperCamelCase    (     self					:						List[Any]				, *a					:						Union[str, Any]				, **a					:						int    ):





            """simple docstring"""







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


      @property
      def _UpperCamelCase    (     self					:						Tuple    ):





            """simple docstring"""







            __snake_case   :     str	      =self.tokenizer.model_input_names
            __snake_case   :     List[str]	      =self.image_processor.model_input_names
            return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names    )    )


      @property
      def _UpperCamelCase    (     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 _UpperCamelCase    (     self					:						List[str]    ):





            """simple docstring"""







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







from __future__ import annotations





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					assert (
					    c % greatest_common_divisor(_UpperCAmelCase       ,			_UpperCAmelCase				) == 0
					)  # greatest_common_divisor(a,b) function implemented below
					((lowercase)   ,      (lowercase)   ,      (lowercase))						   =       extended_gcd(_UpperCAmelCase       ,			_UpperCAmelCase				)  # extended_gcd(a,b) function implemented below
					lowercase						   =       c / d
					return (r * x, r * y)





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase = 2				):
					"""simple docstring"""






					((lowercase)   ,      (lowercase))						   =       diophantine(_UpperCAmelCase       ,			_UpperCAmelCase       ,			_UpperCAmelCase				)  # Initial value
					lowercase						   =       greatest_common_divisor(_UpperCAmelCase       ,			_UpperCAmelCase				)
					lowercase						   =       a // d
					lowercase						   =       b // d

					for i in range(_UpperCAmelCase				):
										lowercase						   =       xa + i * q
										lowercase						   =       ya - i * p
										print(_UpperCAmelCase       ,			_UpperCAmelCase				)





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					if a < b:
										lowercase   ,      lowercase						   =       b, a

					while a % b != 0:
										lowercase   ,      lowercase						   =       b, a % b

					return b





def 		__snake_case						(    _UpperCAmelCase       ,			_UpperCAmelCase				):
					"""simple docstring"""






					assert a >= 0 and b >= 0

					if b == 0:
										lowercase   ,      lowercase   ,      lowercase						   =       a, 1, 0
					else:
										((lowercase)   ,      (lowercase)   ,      (lowercase))						   =       extended_gcd(_UpperCAmelCase       ,			a % b				)
										lowercase						   =       q
										lowercase						   =       p - q * (a // b)

					assert a % d == 0 and b % d == 0
					assert d == a * x + b * y

					return (d, x, y)


if __name__ == "__main__":
		from doctest import testmod

		testmod(name='''diophantine''', verbose=True)
		testmod(name='''diophantine_all_soln''', verbose=True)
		testmod(name='''extended_gcd''', verbose=True)
		testmod(name='''greatest_common_divisor''', verbose=True)






