code: 
  
  
  
  
  
  from typing import Dict, List, Optional, Union
  
  import numpy as np
  
  from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
  from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format
  from ...image_utils import (
      IMAGENET_DEFAULT_MEAN,
      IMAGENET_DEFAULT_STD,
      ChannelDimension,
      ImageInput,
      PILImageResampling,
      get_image_size,
      make_list_of_images,
      to_numpy_array,
      valid_images,
  )
  from ...utils import TensorType, is_vision_available, logging
  
  
  if is_vision_available():
  		import PIL
  
  
  _lowercase		:     List[str] 					=logging.get_logger(__name__)
  
  
  
  
  
  
  class 	UpperCamelCase_     (     snake_case__       ):
  					_a			:	List[Any]							=				['pixel_values']
  
  
  
  					def __init__(		self    :    List[Any]					,			lowerCamelCase    :    bool = True					,			lowerCamelCase    :    Dict[str, int] = None					,			lowerCamelCase    :    bool = True					,			lowerCamelCase    :    Dict[str, int] = None					,			lowerCamelCase    :    PILImageResampling = PILImageResampling.BICUBIC					,			lowerCamelCase    :    bool = True					,			lowerCamelCase    :    Union[int, float] = 1 / 2_55					,			lowerCamelCase    :    bool = True					,			lowerCamelCase    :    Optional[Union[float, List[float]]] = None					,			lowerCamelCase    :    Optional[Union[float, List[float]]] = None					,			**lowerCamelCase    :    Dict					,			):
  							super().__init__(**lowerCamelCase	)
  							lowerCamelCase_  :    str   	=			crop_size if crop_size is not None else {'height': 2_56, 'width': 2_56}
  							lowerCamelCase_  :    Optional[Any]   	=			get_size_dict(lowerCamelCase					,			param_name='crop_size'	)
  							lowerCamelCase_  :    int   	=			size if size is not None else {'height': 2_24, 'width': 2_24}
  							lowerCamelCase_  :    Union[str, Any]   	=			get_size_dict(lowerCamelCase	)
  
  							lowerCamelCase_  :    str   	=			do_center_crop
  							lowerCamelCase_  :    List[str]   	=			crop_size
  							lowerCamelCase_  :    List[str]   	=			do_resize
  							lowerCamelCase_  :    Optional[Any]   	=			size
  							lowerCamelCase_  :    List[str]   	=			resample
  							lowerCamelCase_  :    Dict   	=			do_rescale
  							lowerCamelCase_  :    str   	=			rescale_factor
  							lowerCamelCase_  :    int   	=			do_normalize
  							lowerCamelCase_  :    List[str]   	=			image_mean if image_mean is not None else IMAGENET_DEFAULT_MEAN
  							lowerCamelCase_  :    List[str]   	=			image_std if image_std is not None else IMAGENET_DEFAULT_STD
  
  
  
  					def      __a    (		self    :    Any					,			lowerCamelCase    :    np.ndarray					,			lowerCamelCase    :    Dict[str, int]					,			lowerCamelCase    :    Optional[int] = None					,			lowerCamelCase    :    Optional[Union[str, ChannelDimension]] = None					,			**lowerCamelCase    :    str					,			):
  							lowerCamelCase_  :    int   	=			self.size if size is None else size
  							lowerCamelCase_  :    Union[str, Any]   	=			get_size_dict(lowerCamelCase	)
  							lowerCamelCase_  :    Union[str, Any]   	=			get_size_dict(lowerCamelCase					,			param_name='crop_size'	)
  
  							lowerCamelCase_	,			lowerCamelCase_  :    Dict   	=			get_image_size(lowerCamelCase	)
  							lowerCamelCase_  :    int   	=			min(lowerCamelCase					,			lowerCamelCase	)
  							lowerCamelCase_  :    List[Any]   	=			(size['height'] / crop_size['height']) * min_dim
  							lowerCamelCase_  :    Dict   	=			(size['width'] / crop_size['width']) * min_dim
  							return center_crop(lowerCamelCase					,			size=(cropped_height, cropped_width)					,			data_format=lowerCamelCase					,			**lowerCamelCase	)
  
  
  
  					def      __a    (		self    :    str					,			lowerCamelCase    :    np.ndarray					,			lowerCamelCase    :    Dict[str, int]					,			lowerCamelCase    :    PILImageResampling = PIL.Image.BICUBIC					,			lowerCamelCase    :    Optional[Union[str, ChannelDimension]] = None					,			**lowerCamelCase    :    Optional[int]					,			):
  							lowerCamelCase_  :    Any   	=			get_size_dict(lowerCamelCase	)
  							if "height" not in size or "width" not in size:
  									raise ValueError(F"The size dictionary must contain the keys 'height' and 'width'. Got {size.keys()}"	)
  							return resize(
  							    lowerCamelCase					,			size=(size['height'], size['width'])					,			resample=lowerCamelCase					,			data_format=lowerCamelCase					,			**lowerCamelCase	)
  
  
  
  					def      __a    (		self    :    List[str]					,			lowerCamelCase    :    np.ndarray					,			lowerCamelCase    :    Union[int, float]					,			lowerCamelCase    :    Optional[Union[str, ChannelDimension]] = None					,			**lowerCamelCase    :    Tuple					,			):
  							return rescale(lowerCamelCase					,			scale=lowerCamelCase					,			data_format=lowerCamelCase					,			**lowerCamelCase	)
  
  
  
  					def      __a    (		self    :    List[str]					,			lowerCamelCase    :    np.ndarray					,			lowerCamelCase    :    Union[float, List[float]]					,			lowerCamelCase    :    Union[float, List[float]]					,			lowerCamelCase    :    Optional[Union[str, ChannelDimension]] = None					,			**lowerCamelCase    :    Optional[Any]					,			):
  							return normalize(lowerCamelCase					,			mean=lowerCamelCase					,			std=lowerCamelCase					,			data_format=lowerCamelCase					,			**lowerCamelCase	)
  
  
  
  
  
  					def      __a    (		self    :    str					,			lowerCamelCase    :    ImageInput					,			lowerCamelCase    :    Optional[bool] = None					,			lowerCamelCase    :    Optional[Dict[str, int]] = None					,			lowerCamelCase    :    Optional[bool] = None					,			lowerCamelCase    :    Optional[Dict[str, int]] = None					,			lowerCamelCase    :    PILImageResampling = None					,			lowerCamelCase    :    Optional[bool] = None					,			lowerCamelCase    :    Optional[float] = None					,			lowerCamelCase    :    Optional[bool] = None					,			lowerCamelCase    :    Optional[Union[float, List[float]]] = None					,			lowerCamelCase    :    Optional[Union[float, List[float]]] = None					,			lowerCamelCase    :    Optional[Union[str, TensorType]] = None					,			lowerCamelCase    :    ChannelDimension = ChannelDimension.FIRST					,			**lowerCamelCase    :    Any					,			):
  							lowerCamelCase_  :    Union[str, Any]   	=			do_center_crop if do_center_crop is not None else self.do_center_crop
  							lowerCamelCase_  :    Dict   	=			crop_size if crop_size is not None else self.crop_size
  							lowerCamelCase_  :    int   	=			get_size_dict(lowerCamelCase					,			param_name='crop_size'	)
  							lowerCamelCase_  :    Union[str, Any]   	=			do_resize if do_resize is not None else self.do_resize
  							lowerCamelCase_  :    Union[str, Any]   	=			size if size is not None else self.size
  							lowerCamelCase_  :    Dict   	=			get_size_dict(lowerCamelCase	)
  							lowerCamelCase_  :    int   	=			resample if resample is not None else self.resample
  							lowerCamelCase_  :    List[str]   	=			do_rescale if do_rescale is not None else self.do_rescale
  							lowerCamelCase_  :    Dict   	=			rescale_factor if rescale_factor is not None else self.rescale_factor
  							lowerCamelCase_  :    List[str]   	=			do_normalize if do_normalize is not None else self.do_normalize
  							lowerCamelCase_  :    Tuple   	=			image_mean if image_mean is not None else self.image_mean
  							lowerCamelCase_  :    List[str]   	=			image_std if image_std is not None else self.image_std
  
  							lowerCamelCase_  :    str   	=			make_list_of_images(lowerCamelCase	)
  
  							if not valid_images(lowerCamelCase	):
  									raise ValueError(
  									    'Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, '
  									    'torch.Tensor, tf.Tensor or jax.ndarray.'	)
  
  							if do_center_crop and crop_size is None:
  									raise ValueError('If `do_center_crop` is set to `True`, `crop_size` must be provided.'	)
  
  							if do_resize and size is None:
  									raise ValueError('Size must be specified if do_resize is True.'	)
  
  							if do_rescale and rescale_factor is None:
  									raise ValueError('Rescale factor must be specified if do_rescale is True.'	)
  
  							if do_normalize and (image_mean is None or image_std is None):
  									raise ValueError('Image mean and image standard deviation must be specified if do_normalize is True.'	)
  
  							# All transformations expect numpy arrays.
  							lowerCamelCase_  :    Optional[Any]   	=			[to_numpy_array(lowerCamelCase	) for image in images]
  
  							if do_center_crop:
  									lowerCamelCase_  :    List[str]   	=			[self.center_crop(lowerCamelCase					,			lowerCamelCase					,			size=lowerCamelCase	) for image in images]
  
  							if do_resize:
  									lowerCamelCase_  :    Union[str, Any]   	=			[self.resize(image=lowerCamelCase					,			size=lowerCamelCase					,			resample=lowerCamelCase	) for image in images]
  
  							if do_rescale:
  									lowerCamelCase_  :    Any   	=			[self.rescale(image=lowerCamelCase					,			scale=lowerCamelCase	) for image in images]
  
  							if do_normalize:
  									lowerCamelCase_  :    Optional[Any]   	=			[self.normalize(image=lowerCamelCase					,			mean=lowerCamelCase					,			std=lowerCamelCase	) for image in images]
  
  							lowerCamelCase_  :    Union[str, Any]   	=			[to_channel_dimension_format(lowerCamelCase					,			lowerCamelCase	) for image in images]
  
  							lowerCamelCase_  :    Dict   	=			{'pixel_values': images}
  							return BatchFeature(data=lowerCamelCase					,			tensor_type=lowerCamelCase	)
  
style_context: 
  
  
  
  
  
  from __future__ import annotations
  
  
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__	):
  		lowerCamelCase_  :    int
  		lowerCamelCase_  :    list[str]   	=			list(lowerCAmelCase__	)
  		lowerCamelCase_	,			lowerCamelCase_  :    List[str]   	=			_vector[:-1], int(_vector[-1]	)
  		lowerCamelCase_  :    list[int]   	=			[int(lowerCAmelCase__	) for digit in __vector]
  
  		vector.reverse()
  		for i, digit in enumerate(lowerCAmelCase__	):
  				if i & 1 == 0:
  						lowerCamelCase_  :    int   	=			digit * 2
  						if doubled > 9:
  								doubled -= 9
  						check_digit += doubled
  				else:
  						check_digit += digit
  
  		return check_digit % 10 == 0
  
  
  if __name__ == "__main__":
  		import doctest
  
  		doctest.testmod()
  		assert is_luhn("""79927398713""")
  		assert not is_luhn("""79927398714""")
  