




'''simple docstring'''





from .hash_table import HashTable
from .number_theory.prime_numbers import is_prime, next_prime




class     UpperCamelCase					(  snake_case__					):



  def __init__( self		,    *__lowerCAmelCase		,    **__lowerCAmelCase   ):







      '''simple docstring'''


      super().__init__(*__lowerCAmelCase		,    **__lowerCAmelCase   )



  def 						a_       ( self		,    __lowerCAmelCase		,    __lowerCAmelCase   ):







      '''simple docstring'''


      _a							:       Optional[int]       					=			(
          next_prime(value % self.size_table   )
          if not is_prime(value % self.size_table   )
          else value % self.size_table
      )  # gt = bigger than
      return next_prime_gt - (data % next_prime_gt)



  def 						a_       ( self		,    __lowerCAmelCase		,    __lowerCAmelCase		,    __lowerCAmelCase   ):







      '''simple docstring'''


      return (increment * self.__hash_function_a(__lowerCAmelCase		,    __lowerCAmelCase   )) % self.size_table



  def 						a_       ( self		,    __lowerCAmelCase		,    __lowerCAmelCase=None   ):







      '''simple docstring'''


      _a							:       Any       					=			1
      _a							:       Dict       					=			self.hash_function(__lowerCAmelCase   )

      while self.values[new_key] is not None and self.values[new_key] != key:
          _a							:       Union[str, Any]       					=			(
              self.__hash_double_function(__lowerCAmelCase		,    __lowerCAmelCase		,    __lowerCAmelCase   )
              if self.balanced_factor() >= self.lim_charge
              else None
          )
          if new_key is None:
              break
          else:
              i += 1

      return new_key








'''simple docstring'''





import unittest

import torch

from diffusers import DDIMScheduler, TextToVideoZeroPipeline
from diffusers.utils import load_pt, require_torch_gpu, slow

from ..test_pipelines_common import assert_mean_pixel_difference




@slow
@require_torch_gpu
class     UpperCamelCase					(  unittest.TestCase					):



  def 						a_       ( self   ):







      '''simple docstring'''


      _a							:       List[Any]       					=			"""runwayml/stable-diffusion-v1-5"""
      _a							:       Tuple       					=			TextToVideoZeroPipeline.from_pretrained(__lowerCAmelCase		,    torch_dtype=torch.floataa   ).to("""cuda"""   )
      _a							:       Dict       					=			DDIMScheduler.from_config(pipe.scheduler.config   )
      _a							:       int       					=			torch.Generator(device="""cuda"""   ).manual_seed(0   )

      _a							:       Union[str, Any]       					=			"""A bear is playing a guitar on Times Square"""
      _a							:       List[Any]       					=			pipe(prompt=__lowerCAmelCase		,    generator=__lowerCAmelCase   ).images

      _a							:       Any       					=			load_pt(
          """https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/text-to-video/A bear is playing a guitar on Times Square.pt"""   )

      assert_mean_pixel_difference(__lowerCAmelCase		,    __lowerCAmelCase   )


