

def      a      (			A__	:   Optional[Any]     )    ->      List[str]:





      """simple docstring"""



      return credit_card_number.startswith(('34', '35', '37', '4', '5', '6')     )
def      a      (			A__	:   Union[str, Any]     )    ->      Dict:





      """simple docstring"""



      _lowercase	       =credit_card_number
      _lowercase	       =0
      _lowercase	       =len(UpperCamelCase__     ) - 2
      for i in range(UpperCamelCase__      ,   -1      ,   -2     ):
            #  double the value of every second digit
            _lowercase	       =int(cc_number[i]     )
            digit *= 2
            # If doubling of a number results in a two digit number
            # i.e greater than 9(e.g., 6 × 2 = 12),
            # then add the digits of the product (e.g., 12: 1 + 2 = 3, 15: 1 + 5 = 6),
            # to get a single digit number.
            if digit > 9:
                  digit %= 10
                  digit += 1
            _lowercase	       =cc_number[:i] + str(UpperCamelCase__     ) + cc_number[i + 1 :]
            total += digit

      # Sum up the remaining digits
      for i in range(len(UpperCamelCase__     ) - 1      ,   -1      ,   -2     ):
            total += int(cc_number[i]     )

      return total % 10 == 0
def      a      (			A__	:   Union[str, Any]     )    ->      Optional[Any]:





      """simple docstring"""



      _lowercase	       =F'''{credit_card_number} is an invalid credit card number because'''
      if not credit_card_number.isdigit():
            print(F'''{error_message} it has nonnumerical characters.'''     )
            return False

      if not 13 <= len(UpperCamelCase__     ) <= 16:
            print(F'''{error_message} of its length.'''     )
            return False

      if not validate_initial_digits(UpperCamelCase__     ):
            print(F'''{error_message} of its first two digits.'''     )
            return False

      if not luhn_validation(UpperCamelCase__     ):
            print(F'''{error_message} it fails the Luhn check.'''     )
            return False

      print(F'''{credit_card_number} is a valid credit card number.'''     )
      return True


if __name__ == "__main__":
  import doctest

  doctest.testmod()
  validate_credit_card_number('4111111111111111')
  validate_credit_card_number('32323')





import gc
import unittest

from diffusers import FlaxStableDiffusionInpaintPipeline
from diffusers.utils import is_flax_available, load_image, slow
from diffusers.utils.testing_utils import require_flax


if is_flax_available():
					import jax
					import jax.numpy as jnp
					from flax.jax_utils import replicate
					from flax.training.common_utils import shard







@slow
@require_flax
class  lowercase				(       unittest.TestCase			):




				def     a							(					self       ):
											# clean up the VRAM after each test
											super().tearDown()
											gc.collect()




				def     a							(					self       ):
											snake_case_							=    load_image(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main'
											    '/sd2-inpaint/init_image.png'       )
											snake_case_							=    load_image(
											    'https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-inpaint/mask.png'       )

											snake_case_							=    'xvjiarui/stable-diffusion-2-inpainting'
											snake_case_				,    snake_case_							=    FlaxStableDiffusionInpaintPipeline.from_pretrained(snake_case      ,   safety_checker=snake_case       )

											snake_case_							=    'Face of a yellow cat, high resolution, sitting on a park bench'

											snake_case_							=    jax.random.PRNGKey(0       )
											snake_case_							=    50

											snake_case_							=    jax.device_count()
											snake_case_							=    num_samples * [prompt]
											snake_case_							=    num_samples * [init_image]
											snake_case_							=    num_samples * [mask_image]
											snake_case_				,    snake_case_				,    snake_case_							=    pipeline.prepare_inputs(snake_case      ,   snake_case      ,   snake_case       )

											# shard inputs and rng
											snake_case_							=    replicate(snake_case       )
											snake_case_							=    jax.random.split(snake_case      ,   jax.device_count()       )
											snake_case_							=    shard(snake_case       )
											snake_case_							=    shard(snake_case       )
											snake_case_							=    shard(snake_case       )

											snake_case_							=    pipeline(
											    snake_case      ,   snake_case      ,   snake_case      ,   snake_case      ,   snake_case      ,   snake_case      ,   jit=snake_case       )

											snake_case_							=    output.images.reshape(snake_case      ,   512      ,   512      ,   3       )

											snake_case_							=    images[0, 253:256, 253:256, -1]

											snake_case_							=    jnp.asarray(jax.device_get(image_slice.flatten()       )       )
											snake_case_							=    jnp.array(
											    [0.3_61_13_07, 0.37_64_97_36, 0.3_75_74_08, 0.38_21_39_53, 0.39_29_51_67, 0.3_84_16_31, 0.41_55_49_78, 0.4_13_74_75, 0.4_21_70_84]       )
											print(F'''output_slice: {output_slice}'''       )
											assert jnp.abs(output_slice - expected_slice       ).max() < 1e-2




