import warnings
from typing import List, Optional, Union

from ...image_utils import ImageInput
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class SCREAMING_SNAKE_CASE_		(      __lowerCAmelCase		):
   __lowerCAmelCase           =				["""image_processor""", """tokenizer"""]
   __lowerCAmelCase           =				"""FlavaImageProcessor"""
   __lowerCAmelCase           =				("""BertTokenizer""", """BertTokenizerFast""")







   def __init__(     self						:						Union[str, Any]   ,   lowerCamelCase_						:						Dict=None   ,   lowerCamelCase_						:						Optional[int]=None   ,   **lowerCamelCase_						:						Optional[Any]				):





    """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."""   ,   lowerCamelCase_   ,   )
     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__(lowerCamelCase_   ,   lowerCamelCase_				)
    UpperCamelCase			  =      self.image_processor







   def __call__(     self						:						Tuple   ,   lowerCamelCase_						:						Optional[ImageInput] = None   ,   lowerCamelCase_						:						Optional[Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]]] = None   ,   lowerCamelCase_						:						bool = True   ,   lowerCamelCase_						:						Union[bool, str, PaddingStrategy] = False   ,   lowerCamelCase_						:						Union[bool, str, TruncationStrategy] = False   ,   lowerCamelCase_						:						Optional[int] = None   ,   lowerCamelCase_						:						int = 0   ,   lowerCamelCase_						:						Optional[int] = None   ,   lowerCamelCase_						:						Optional[bool] = None   ,   lowerCamelCase_						:						Optional[bool] = None   ,   lowerCamelCase_						:						Optional[bool] = None   ,   lowerCamelCase_						:						Optional[bool] = None   ,   lowerCamelCase_						:						bool = False   ,   lowerCamelCase_						:						bool = False   ,   lowerCamelCase_						:						bool = False   ,   lowerCamelCase_						:						bool = False   ,   lowerCamelCase_						:						bool = True   ,   lowerCamelCase_						:						Optional[Union[str, TensorType]] = None   ,   **lowerCamelCase_						:						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:
     UpperCamelCase			  =      self.tokenizer(
         text=lowerCamelCase_   ,   add_special_tokens=lowerCamelCase_   ,   padding=lowerCamelCase_   ,   truncation=lowerCamelCase_   ,   max_length=lowerCamelCase_   ,   stride=lowerCamelCase_   ,   pad_to_multiple_of=lowerCamelCase_   ,   return_token_type_ids=lowerCamelCase_   ,   return_attention_mask=lowerCamelCase_   ,   return_overflowing_tokens=lowerCamelCase_   ,   return_special_tokens_mask=lowerCamelCase_   ,   return_offsets_mapping=lowerCamelCase_   ,   return_length=lowerCamelCase_   ,   verbose=lowerCamelCase_   ,   return_tensors=lowerCamelCase_   ,   **lowerCamelCase_   ,   )
    if images is not None:
     UpperCamelCase			  =      self.image_processor(
         lowerCamelCase_   ,   return_image_mask=lowerCamelCase_   ,   return_codebook_pixels=lowerCamelCase_   ,   return_tensors=lowerCamelCase_   ,   **lowerCamelCase_   ,   )

    if text is not None and images is not None:
     encoding.update(lowerCamelCase_				)
     return encoding
    elif text is not None:
     return encoding
    else:
     return BatchEncoding(data=dict(**lowerCamelCase_				)   ,   tensor_type=lowerCamelCase_				)







   def 						lowerCamelCase_	(     self						:						Optional[Any]   ,   *lowerCamelCase_						:						Any   ,   **lowerCamelCase_						:						Union[str, Any]				):





    """simple docstring"""


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







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





    """simple docstring"""


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







   @property
   def 						lowerCamelCase_	(     self						:						Optional[Any]				):





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





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







   @property
   def 						lowerCamelCase_	(     self						:						str				):





    """simple docstring"""


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

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    8_0_0,
    7_9_9,
    6_0_0,
    5_9_9,
    5_0_0,
    4_0_0,
    3_9_9,
    3_7_7,
    3_5_5,
    3_3_3,
    3_1_1,
    2_8_8,
    2_6_6,
    2_4_4,
    2_2_2,
    2_0_0,
    1_9_9,
    1_7_7,
    1_5_5,
    1_3_3,
    1_1_1,
    8_8,
    6_6,
    4_4,
    2_2,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_7_6,
    9_5_2,
    9_2_8,
    9_0_5,
    8_8_2,
    8_5_8,
    8_5_7,
    8_1_0,
    7_6_2,
    7_1_5,
    7_1_4,
    5_7_2,
    4_2_9,
    4_2_8,
    2_8_6,
    2_8_5,
    2_3_8,
    1_9_0,
    1_4_3,
    1_4_2,
    1_1_8,
    9_5,
    7_1,
    4_7,
    2_4,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_8_8,
    9_7_7,
    9_6_6,
    9_5_5,
    9_4_4,
    9_3_3,
    9_2_2,
    9_1_1,
    9_0_0,
    8_9_9,
    8_7_9,
    8_5_9,
    8_4_0,
    8_2_0,
    8_0_0,
    7_9_9,
    7_6_6,
    7_3_3,
    7_0_0,
    6_9_9,
    6_5_0,
    6_0_0,
    5_9_9,
    5_0_0,
    4_9_9,
    4_0_0,
    3_9_9,
    3_5_0,
    3_0_0,
    2_9_9,
    2_6_6,
    2_3_3,
    2_0_0,
    1_9_9,
    1_7_9,
    1_5_9,
    1_4_0,
    1_2_0,
    1_0_0,
    9_9,
    8_8,
    7_7,
    6_6,
    5_5,
    4_4,
    3_3,
    2_2,
    1_1,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_9_5,
    9_9_2,
    9_8_9,
    9_8_5,
    9_8_1,
    9_7_8,
    9_7_5,
    9_7_1,
    9_6_7,
    9_6_4,
    9_6_1,
    9_5_7,
    9_5_6,
    9_5_1,
    9_4_7,
    9_4_2,
    9_3_7,
    9_3_3,
    9_2_8,
    9_2_3,
    9_1_9,
    9_1_4,
    9_1_3,
    9_0_8,
    9_0_3,
    8_9_7,
    8_9_2,
    8_8_7,
    8_8_1,
    8_7_6,
    8_7_1,
    8_7_0,
    8_6_4,
    8_5_8,
    8_5_2,
    8_4_6,
    8_4_0,
    8_3_4,
    8_2_8,
    8_2_7,
    8_2_0,
    8_1_3,
    8_0_6,
    7_9_9,
    7_9_2,
    7_8_5,
    7_8_4,
    7_7_7,
    7_7_0,
    7_6_3,
    7_5_6,
    7_4_9,
    7_4_2,
    7_4_1,
    7_3_3,
    7_2_4,
    7_1_6,
    7_0_7,
    6_9_9,
    6_9_8,
    6_8_8,
    6_7_7,
    6_6_6,
    6_5_6,
    6_5_5,
    6_4_5,
    6_3_4,
    6_2_3,
    6_1_3,
    6_1_2,
    5_9_8,
    5_8_4,
    5_7_0,
    5_6_9,
    5_5_5,
    5_4_1,
    5_2_7,
    5_2_6,
    5_0_5,
    4_8_4,
    4_8_3,
    4_6_2,
    4_4_0,
    4_3_9,
    3_9_6,
    3_9_5,
    3_5_2,
    3_5_1,
    3_0_8,
    3_0_7,
    2_6_4,
    2_6_3,
    2_2_0,
    2_1_9,
    1_7_6,
    1_3_2,
    8_8,
    4_4,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_9_7,
    9_9_5,
    9_9_2,
    9_9_0,
    9_8_8,
    9_8_6,
    9_8_4,
    9_8_1,
    9_7_9,
    9_7_7,
    9_7_5,
    9_7_2,
    9_7_0,
    9_6_8,
    9_6_6,
    9_6_4,
    9_6_1,
    9_5_9,
    9_5_7,
    9_5_6,
    9_5_4,
    9_5_1,
    9_4_9,
    9_4_6,
    9_4_4,
    9_4_1,
    9_3_9,
    9_3_6,
    9_3_4,
    9_3_1,
    9_2_9,
    9_2_6,
    9_2_4,
    9_2_1,
    9_1_9,
    9_1_6,
    9_1_4,
    9_1_3,
    9_1_0,
    9_0_7,
    9_0_5,
    9_0_2,
    8_9_9,
    8_9_6,
    8_9_3,
    8_9_1,
    8_8_8,
    8_8_5,
    8_8_2,
    8_7_9,
    8_7_7,
    8_7_4,
    8_7_1,
    8_7_0,
    8_6_7,
    8_6_4,
    8_6_1,
    8_5_8,
    8_5_5,
    8_5_2,
    8_4_9,
    8_4_6,
    8_4_3,
    8_4_0,
    8_3_7,
    8_3_4,
    8_3_1,
    8_2_8,
    8_2_7,
    8_2_4,
    8_2_1,
    8_1_7,
    8_1_4,
    8_1_1,
    8_0_8,
    8_0_4,
    8_0_1,
    7_9_8,
    7_9_5,
    7_9_1,
    7_8_8,
    7_8_5,
    7_8_4,
    7_8_0,
    7_7_7,
    7_7_4,
    7_7_0,
    7_6_6,
    7_6_3,
    7_6_0,
    7_5_6,
    7_5_2,
    7_4_9,
    7_4_6,
    7_4_2,
    7_4_1,
    7_3_7,
    7_3_3,
    7_3_0,
    7_2_6,
    7_2_2,
    7_1_8,
    7_1_4,
    7_1_0,
    7_0_7,
    7_0_3,
    6_9_9,
    6_9_8,
    6_9_4,
    6_9_0,
    6_8_5,
    6_8_1,
    6_7_7,
    6_7_3,
    6_6_9,
    6_6_4,
    6_6_0,
    6_5_6,
    6_5_5,
    6_5_0,
    6_4_6,
    6_4_1,
    6_3_6,
    6_3_2,
    6_2_7,
    6_2_2,
    6_1_8,
    6_1_3,
    6_1_2,
    6_0_7,
    6_0_2,
    5_9_6,
    5_9_1,
    5_8_6,
    5_8_0,
    5_7_5,
    5_7_0,
    5_6_9,
    5_6_3,
    5_5_7,
    5_5_1,
    5_4_5,
    5_3_9,
    5_3_3,
    5_2_7,
    5_2_6,
    5_1_9,
    5_1_2,
    5_0_5,
    4_9_8,
    4_9_1,
    4_8_4,
    4_8_3,
    4_7_4,
    4_6_6,
    4_5_7,
    4_4_9,
    4_4_0,
    4_3_9,
    4_2_8,
    4_1_8,
    4_0_7,
    3_9_6,
    3_9_5,
    3_8_1,
    3_6_6,
    3_5_2,
    3_5_1,
    3_3_0,
    3_0_8,
    3_0_7,
    2_8_6,
    2_6_4,
    2_6_3,
    2_4_2,
    2_2_0,
    2_1_9,
    1_7_6,
    1_7_5,
    1_3_2,
    1_3_1,
    8_8,
    4_4,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_9_1,
    9_8_2,
    9_7_4,
    9_6_6,
    9_5_8,
    9_5_0,
    9_4_1,
    9_3_3,
    9_2_5,
    9_1_6,
    9_0_8,
    9_0_0,
    8_9_9,
    8_7_4,
    8_5_0,
    8_2_5,
    8_0_0,
    7_9_9,
    7_0_0,
    6_0_0,
    5_0_0,
    4_0_0,
    3_0_0,
    2_0_0,
    1_0_0,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_9_2,
    9_8_5,
    9_7_8,
    9_7_1,
    9_6_4,
    9_5_7,
    9_4_9,
    9_4_2,
    9_3_5,
    9_2_8,
    9_2_1,
    9_1_4,
    9_0_7,
    9_0_0,
    8_9_9,
    8_7_9,
    8_5_9,
    8_4_0,
    8_2_0,
    8_0_0,
    7_9_9,
    7_6_6,
    7_3_3,
    7_0_0,
    6_9_9,
    6_5_0,
    6_0_0,
    5_9_9,
    5_0_0,
    4_9_9,
    4_0_0,
    3_9_9,
    3_0_0,
    2_9_9,
    2_0_0,
    1_9_9,
    1_0_0,
    9_9,
    0,
]

_SCREAMING_SNAKE_CASE 		=      [
    9_9_9,
    9_9_6,
    9_9_2,
    9_8_9,
    9_8_5,
    9_8_2,
    9_7_9,
    9_7_5,
    9_7_2,
    9_6_8,
    9_6_5,
    9_6_1,
    9_5_8,
    9_5_5,
    9_5_1,
    9_4_8,
    9_4_4,
    9_4_1,
    9_3_8,
    9_3_4,
    9_3_1,
    9_2_7,
    9_2_4,
    9_2_0,
    9_1_7,
    9_1_4,
    9_1_0,
    9_0_7,
    9_0_3,
    9_0_0,
    8_9_9,
    8_9_1,
    8_8_4,
    8_7_6,
    8_6_9,
    8_6_1,
    8_5_3,
    8_4_6,
    8_3_8,
    8_3_0,
    8_2_3,
    8_1_5,
    8_0_8,
    8_0_0,
    7_9_9,
    7_8_8,
    7_7_7,
    7_6_6,
    7_5_5,
    7_4_4,
    7_3_3,
    7_2_2,
    7_1_1,
    7_0_0,
    6_9_9,
    6_8_8,
    6_7_7,
    6_6_6,
    6_5_5,
    6_4_4,
    6_3_3,
    6_2_2,
    6_1_1,
    6_0_0,
    5_9_9,
    5_8_5,
    5_7_1,
    5_5_7,
    5_4_2,
    5_2_8,
    5_1_4,
    5_0_0,
    4_9_9,
    4_8_5,
    4_7_1,
    4_5_7,
    4_4_2,
    4_2_8,
    4_1_4,
    4_0_0,
    3_9_9,
    3_7_9,
    3_5_9,
    3_4_0,
    3_2_0,
    3_0_0,
    2_9_9,
    2_7_9,
    2_5_9,
    2_4_0,
    2_2_0,
    2_0_0,
    1_9_9,
    1_6_6,
    1_3_3,
    1_0_0,
    9_9,
    6_6,
    3_3,
    0,
]
