



"""simple docstring"""







import warnings

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







class 				UpperCamelCase__       (     lowercase_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE      =					["""image_processor""", """tokenizer"""]
      _SCREAMING_SNAKE_CASE      =					"""CLIPImageProcessor"""
      _SCREAMING_SNAKE_CASE      =					("""XLMRobertaTokenizer""", """XLMRobertaTokenizerFast""")



      def __init__(				self    :				Dict   ,      SCREAMING_SNAKE_CASE_    :				Optional[int]=None   ,      SCREAMING_SNAKE_CASE_    :				Union[str, Any]=None   ,      **SCREAMING_SNAKE_CASE_    :				List[Any]	):
        lowerCAmelCase_       :    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.'   ,      SCREAMING_SNAKE_CASE_   ,      )
          lowerCAmelCase_       :    Tuple								=			kwargs.pop('feature_extractor'	)

        lowerCAmelCase_       :    Optional[Any]								=			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    :				List[str]   ,      SCREAMING_SNAKE_CASE_    :				Any=None   ,      SCREAMING_SNAKE_CASE_    :				str=None   ,      SCREAMING_SNAKE_CASE_    :				int=None   ,      **SCREAMING_SNAKE_CASE_    :				Optional[int]	):

        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:
          lowerCAmelCase_       :    Optional[Any]								=			self.tokenizer(SCREAMING_SNAKE_CASE_   ,      return_tensors=SCREAMING_SNAKE_CASE_   ,      **SCREAMING_SNAKE_CASE_	)

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

        if text is not None and images is not None:
          lowerCAmelCase_       :    Dict								=			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 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]   ,      *SCREAMING_SNAKE_CASE_    :				Dict   ,      **SCREAMING_SNAKE_CASE_    :				Tuple	):
        return self.tokenizer.batch_decode(*SCREAMING_SNAKE_CASE_   ,      **SCREAMING_SNAKE_CASE_	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Optional[int]   ,      *SCREAMING_SNAKE_CASE_    :				Union[str, Any]   ,      **SCREAMING_SNAKE_CASE_    :				List[Any]	):
        return self.tokenizer.decode(*SCREAMING_SNAKE_CASE_   ,      **SCREAMING_SNAKE_CASE_	)





      @property
      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        lowerCAmelCase_       :    List[Any]								=			self.tokenizer.model_input_names
        lowerCAmelCase_       :    str								=			self.image_processor.model_input_names
        return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names	)	)










"""simple docstring"""







import re

def     UpperCamelCase_   (   lowerCAmelCase__				:    str						)						->       bool:

  """simple docstring"""




  lowerCAmelCase_       :    str								=			re.compile(
      R'^(?:0|94|\+94|0{2}94)' R'7(0|1|2|4|5|6|7|8)' R'(-| |)' R'\d{7}$'						)

  return bool(re.search(lowerCAmelCase__   ,       lowerCAmelCase__						)						)


if __name__ == "__main__":
     lowercase__		:    Optional[int]				   =     """0094702343221"""

     print(is_sri_lankan_phone_number(phone))





