





import warnings

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

class  __A(						__UpperCAmelCase ):
     __A	  =       ["image_processor", "tokenizer"]
     __A	  =       "ChineseCLIPImageProcessor"
     __A	  =       ("BertTokenizer", "BertTokenizerFast")

     def __init__(      self,       A=None,       A=None,       **A      ):





            """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.''',       A,       )
                   _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__(A,       A      )
            _UpperCamelCase              =						self.image_processor

     def __call__(      self,       A=None,       A=None,       A=None,       **A      ):





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

            if images is not None:
                   _UpperCamelCase              =						self.image_processor(A,       return_tensors=A,       **A      )

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

     def 	_UpperCamelCase     (      self,       *A,       **A      ):





            """simple docstring"""

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

     def 	_UpperCamelCase     (      self,       *A,       **A      ):





            """simple docstring"""

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

     @property
     def 	_UpperCamelCase     (      self      ):





            """simple docstring"""

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



     @property
     def 	_UpperCamelCase     (      self      ):





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













def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase					):
       _UpperCamelCase              =						[]
       if len(lowerCAmelCase					) == 1:
              return [nums.copy()]
       for _ in range(len(lowerCAmelCase					)					):
              _UpperCamelCase              =						nums.pop(0					)
              _UpperCamelCase              =						permute(lowerCAmelCase					)
              for perm in permutations:
                     perm.append(lowerCAmelCase					)
              result.extend(lowerCAmelCase					)
              nums.append(lowerCAmelCase					)
       return result


def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase					):

       def backtrack(lowerCAmelCase					):
              if start == len(lowerCAmelCase					) - 1:
                     output.append(nums[:]					)
              else:
                     for i in range(lowerCAmelCase    ,       len(lowerCAmelCase					)					):
                            _UpperCamelCase       ,		_UpperCamelCase              =						nums[i], nums[start]
                            backtrack(start + 1					)
                            _UpperCamelCase       ,		_UpperCamelCase              =						nums[i], nums[start]  # backtrack

       _UpperCamelCase              =						[]
       backtrack(0					)
       return output


if __name__ == "__main__":
       import doctest

       # use res to print the data in permute2 function
       lowercase    : Optional[Any]    	=  permutea([1, 2, 3])
       print(res)
       doctest.testmod()






