



"""simple docstring"""





def        a__     (				lowerCAmelCase__				):
      return credit_card_number.startswith(("34", "35", "37", "4", "5", "6")				)
def        a__     (				lowerCAmelCase__				):
      UpperCAmelCase_      			=							credit_card_number
      UpperCAmelCase_      			=							0
      UpperCAmelCase_      			=							len(lowerCAmelCase__				) - 2
      for i in range(lowerCAmelCase__     ,      -1     ,      -2				):
            #  double the value of every second digit
            UpperCAmelCase_      			=							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
            UpperCAmelCase_      			=							cc_number[:i] + str(lowerCAmelCase__				) + cc_number[i + 1 :]
            total += digit

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

      return total % 10 == 0
def        a__     (				lowerCAmelCase__				):
      UpperCAmelCase_      			=							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(lowerCAmelCase__				) <= 16:
            print(f"""{error_message} of its length."""				)
            return False

      if not validate_initial_digits(lowerCAmelCase__				):
            print(f"""{error_message} of its first two digits."""				)
            return False

      if not luhn_validation(lowerCAmelCase__				):
            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""")









"""simple docstring"""





import unittest

import numpy as np

from diffusers import OnnxStableDiffusionInpaintPipelineLegacy
from diffusers.utils.testing_utils import (
    is_onnx_available,
    load_image,
    load_numpy,
    nightly,
    require_onnxruntime,
    require_torch_gpu,
)


if is_onnx_available():
  import onnxruntime as ort
@nightly
@require_onnxruntime
@require_torch_gpu
class 				lowercase__       (   unittest.TestCase				):







       '''simple docstring'''


       @property
       def 					lowercase__    (							self      :  Tuple   )			->						Any:


             '''simple docstring'''




             return (
                 "CUDAExecutionProvider",
                 {
                     "gpu_mem_limit": "15000000000",  # 15GB
                     "arena_extend_strategy": "kSameAsRequested",
                 },
             )



       @property
       def 					lowercase__    (							self      :  List[str]   )			->						int:


             '''simple docstring'''




             UpperCAmelCase_      			=							ort.SessionOptions()
             UpperCAmelCase_      			=							False
             return options







       def 					lowercase__    (							self      :  Dict   )			->						Optional[Any]:


             '''simple docstring'''




             UpperCAmelCase_      			=							load_image(
                 "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
                 "/in_paint/overture-creations-5sI6fQgYIuo.png"   )
             UpperCAmelCase_      			=							load_image(
                 "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
                 "/in_paint/overture-creations-5sI6fQgYIuo_mask.png"   )
             UpperCAmelCase_      			=							load_numpy(
                 "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main"
                 "/in_paint/red_cat_sitting_on_a_park_bench_onnx.npy"   )

             # using the PNDM scheduler by default
             UpperCAmelCase_      			=							OnnxStableDiffusionInpaintPipelineLegacy.from_pretrained(
                 "CompVis/stable-diffusion-v1-4"		,    revision="onnx"		,    safety_checker=_UpperCAmelCase		,    feature_extractor=_UpperCAmelCase		,    provider=self.gpu_provider		,    sess_options=self.gpu_options		,    )
             pipe.set_progress_bar_config(disable=_UpperCAmelCase   )

             UpperCAmelCase_      			=							"A red cat sitting on a park bench"

             UpperCAmelCase_      			=							np.random.RandomState(0   )
             UpperCAmelCase_      			=							pipe(
                 prompt=_UpperCAmelCase		,    image=_UpperCAmelCase		,    mask_image=_UpperCAmelCase		,    strength=0.75		,    guidance_scale=7.5		,    num_inference_steps=15		,    generator=_UpperCAmelCase		,    output_type="np"		,    )

             UpperCAmelCase_      			=							output.images[0]

             assert image.shape == (512, 512, 3)
             assert np.abs(expected_image - image   ).max() < 1e-2




