

import warnings

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





class  __lowerCAmelCase     (					SCREAMING_SNAKE_CASE							):
  _a									=  ["""image_processor""", """tokenizer"""]
  _a									=  """ChineseCLIPImageProcessor"""
  _a									=  ("""BertTokenizer""", """BertTokenizerFast""")




  def __init__(				self							,   lowerCAmelCase=None							,   lowerCAmelCase=None							,   **lowerCAmelCase					)  -> List[Any]:
        '''simple docstring'''






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

        _lowercase	       =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__(lowerCAmelCase							,   lowerCAmelCase					)
        _lowercase	       =self.image_processor




  def __call__(				self							,   lowerCAmelCase=None							,   lowerCAmelCase=None							,   lowerCAmelCase=None							,   **lowerCAmelCase					)  -> Tuple:
        '''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:
              _lowercase	       =self.tokenizer(lowerCAmelCase							,   return_tensors=lowerCAmelCase							,   **lowerCAmelCase					)

        if images is not None:
              _lowercase	       =self.image_processor(lowerCAmelCase							,   return_tensors=lowerCAmelCase							,   **lowerCAmelCase					)

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




  def   A__     (				self							,   *lowerCAmelCase							,   **lowerCAmelCase					)  -> Tuple:
        '''simple docstring'''






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




  def   A__     (				self							,   *lowerCAmelCase							,   **lowerCAmelCase					)  -> Union[str, Any]:
        '''simple docstring'''






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




  @property
  def   A__     (				self					)  -> int:
        '''simple docstring'''






        _lowercase	       =self.tokenizer.model_input_names
        _lowercase	       =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.'							,   lowerCAmelCase							,   )
        return self.image_processor_class





def      a      (			A__	:   str      ,   A__	:   bool = False     )    ->      str:





      """simple docstring"""



      if not isinstance(A__      ,   A__     ):
            _lowercase	       =F'''Expected string as input, found {type(A__     )}'''
            raise ValueError(A__     )
      if not isinstance(A__      ,   A__     ):
            _lowercase	       =F'''Expected boolean as use_pascal parameter, found {type(A__     )}'''
            raise ValueError(A__     )

      _lowercase	       =input_str.split('_'     )

      _lowercase	       =0 if use_pascal else 1

      _lowercase	       =words[start_index:]

      _lowercase	       =[word[0].upper() + word[1:] for word in words_to_capitalize]

      _lowercase	       ='' if use_pascal else words[0]

      return "".join([initial_word, *capitalized_words]     )


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

  testmod()


