





import warnings

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

class 						SCREAMING_SNAKE_CASE__							(			_UpperCAmelCase    ):
      A_		:							Tuple				=       ['image_processor', 'tokenizer']
      A_		:							Union[str, Any]				=       'CLIPImageProcessor'
      A_		:							Union[str, Any]				=       ('CLIPTokenizer', 'CLIPTokenizerFast')


      def __init__(self			: List[Any]							,     a__			: str=None							,     a__			: Tuple=None							,     **a__			: int ):





         """simple docstring"""



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

         __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__(SCREAMING_SNAKE_CASE_							,     SCREAMING_SNAKE_CASE_ )


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





         """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							=  self.tokenizer(SCREAMING_SNAKE_CASE_							,     return_tensors=SCREAMING_SNAKE_CASE_							,     **SCREAMING_SNAKE_CASE_ )

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

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


      def   a					(self			: int							,     *a__			: str							,     **a__			: str ):





         """simple docstring"""



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


      def   a					(self			: List[str]							,     *a__			: List[Any]							,     **a__			: Optional[int] ):





         """simple docstring"""



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


      @property
      def   a					(self			: Optional[int] ):





         """simple docstring"""



         __snake_case							=  self.tokenizer.model_input_names
         __snake_case							=  self.image_processor.model_input_names
         return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names ) )


      @property
      def   a					(self			: List[str] ):





         """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   a					(self			: List[Any] ):





         """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 argparse


A__						:   Optional[Any]				=    """docs/source/_static/js/custom.js"""



def      UpperCAmelCase__   (      UpperCAmelCase_       :							Optional[int]				)	->						int:
     with open(UpperCAmelCase_ ,       encoding='utf-8' ,       newline='\n'				) as f:
          __lowerCamelCase  :      Dict														=						f.readlines()
     __lowerCamelCase  :      Tuple														=						0

     # First let's put the right version
     while not lines[index].startswith('const stableVersion ='				):
          index += 1
     __lowerCamelCase  :      Dict														=						F'const stableVersion = "v{version}"\n'

     # Then update the dictionary
     while not lines[index].startswith('const versionMapping = {'				):
          index += 1

     # We go until the end
     while not lines[index].startswith('}'				):
          index += 1
     # We add the new version at the end
     lines[index - 1] += F'    "v{version}": "v{version}",\n'

     with open(UpperCAmelCase_ ,       'w' ,       encoding='utf-8' ,       newline='\n'				) as f:
          f.writelines(UpperCAmelCase_				)


if __name__ == "__main__":
      A__						:   str				=    argparse.ArgumentParser()
      parser.add_argument("""--version""", help="""Release version.""")
      A__						:   Any				=    parser.parse_args()
      update_custom_js(args.version)






