






'''simple docstring'''
import warnings

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


class        _UpperCAmelCase						(		snake_case			):
    __lowerCamelCase:   Any		       =    ['image_processor', 'tokenizer']
    __lowerCamelCase:   List[Any]		       =    'ChineseCLIPImageProcessor'
    __lowerCamelCase:   str		       =    ('BertTokenizer', 'BertTokenizerFast')




    def __init__(			self  :       Any  ,     a  :       Tuple=None  ,     a  :       Tuple=None  ,     **a  :       int			):






       '''simple docstring'''






       lowercase_	:    Optional[int]           =     None
       if "feature_extractor" in kwargs:
          warnings.warn(
              "The `feature_extractor` argument is deprecated and will be removed in v5, use `image_processor`"
              " instead."  ,     a  ,     )
          lowercase_	:    Optional[Any]           =     kwargs.pop("feature_extractor"			)

       lowercase_	:    List[str]           =     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__(a  ,     a			)
       lowercase_	:    Tuple           =     self.image_processor




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






       '''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_	:    Tuple           =     self.tokenizer(a  ,     return_tensors=a  ,     **a			)

       if images is not None:
          lowercase_	:    List[Any]           =     self.image_processor(a  ,     return_tensors=a  ,     **a			)

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




    def 				lowerCAmelCase__				(			self  :       List[str]  ,     *a  :       str  ,     **a  :       int			):






       '''simple docstring'''






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




    def 				lowerCAmelCase__				(			self  :       Union[str, Any]  ,     *a  :       Optional[Any]  ,     **a  :       Tuple			):






       '''simple docstring'''






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




    @property
    def 				lowerCAmelCase__				(			self  :       Any			):






       '''simple docstring'''






       lowercase_	:    Union[str, Any]           =     self.tokenizer.model_input_names
       lowercase_	:    Optional[int]           =     self.image_processor.model_input_names
       return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names			)			)





    @property
    def 				lowerCAmelCase__				(			self  :       Tuple			):






       '''simple docstring'''






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












'''simple docstring'''
def 		__SCREAMING_SNAKE_CASE					(  _UpperCamelCase							):


   """simple docstring"""




   if number < 0:
      raise ValueError("number must not be negative"							)
   return number & (number - 1) == 0


if __name__ == "__main__":
 import doctest

 doctest.testmod()




