code: 
  
  
  
  
  
  
  import tempfile
  import unittest
  
  from diffusers import (
      DDIMScheduler,
      DDPMScheduler,
      DPMSolverMultistepScheduler,
      EulerAncestralDiscreteScheduler,
      EulerDiscreteScheduler,
      PNDMScheduler,
      logging,
  )
  from diffusers.configuration_utils import ConfigMixin, register_to_config
  from diffusers.utils.testing_utils import CaptureLogger
  
  
  
  
  
  class     __a						(					A__ ):
   _lowerCAmelCase : Optional[int] 				=				'''config.json'''
  
  
  
  
  
  
  
   @register_to_config
   def __init__(	self      :     Optional[int]							,     SCREAMING_SNAKE_CASE      :     str=2							,     SCREAMING_SNAKE_CASE      :     Any=5							,     SCREAMING_SNAKE_CASE      :     Any=(2, 5)							,     SCREAMING_SNAKE_CASE      :     int="for diffusion"							,     SCREAMING_SNAKE_CASE      :     str=[1, 3]							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        pass
  
  
  
  
  
  
  
  class     __a						(					A__ ):
   _lowerCAmelCase : List[Any] 				=				'''config.json'''
  
  
  
  
  
  
  
   @register_to_config
   def __init__(	self      :     str							,     SCREAMING_SNAKE_CASE      :     Optional[Any]=2							,     SCREAMING_SNAKE_CASE      :     Union[str, Any]=5							,     SCREAMING_SNAKE_CASE      :     Tuple=(2, 5)							,     SCREAMING_SNAKE_CASE      :     List[Any]="for diffusion"							,     SCREAMING_SNAKE_CASE      :     List[Any]=[1, 3]							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        pass
  
  
  
  
  
  
  
  class     __a						(					A__ ):
   _lowerCAmelCase : int 				=				'''config.json'''
  
  
  
  
  
  
  
   @register_to_config
   def __init__(	self      :     str							,     SCREAMING_SNAKE_CASE      :     Union[str, Any]=2							,     SCREAMING_SNAKE_CASE      :     Optional[Any]=5							,     SCREAMING_SNAKE_CASE      :     str=(2, 5)							,     SCREAMING_SNAKE_CASE      :     Dict="for diffusion"							,     SCREAMING_SNAKE_CASE      :     Tuple=[1, 3]							,     SCREAMING_SNAKE_CASE      :     Any=[1, 3]							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        pass
  
  
  
  
  
  
  
  class     __a						(					A__ ):
   _lowerCAmelCase : Optional[int] 				=				'''config.json'''
  
  
  
  
  
  
  
   @register_to_config
   def __init__(	self      :     List[Any]							,     SCREAMING_SNAKE_CASE      :     Any=2							,     SCREAMING_SNAKE_CASE      :     Optional[Any]=5							,     SCREAMING_SNAKE_CASE      :     str=(2, 5)							,     SCREAMING_SNAKE_CASE      :     Optional[int]="for diffusion"							,     SCREAMING_SNAKE_CASE      :     Any=[1, 5]							,     SCREAMING_SNAKE_CASE      :     Union[str, Any]=[5, 4]							,     ):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        pass
  
  
  
  
  
  
  
  class     __a						(					unittest.TestCase ):
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     str		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        with self.assertRaises(SCREAMING_SNAKE_CASE		):
             ConfigMixin.load_config("dummy_path"		)
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Tuple		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[Any]        =						SampleObject()
        UpperCamelCase__    :     Any        =						obj.config
        assert config["a"] == 2
        assert config["b"] == 5
        assert config["c"] == (2, 5)
        assert config["d"] == "for diffusion"
        assert config["e"] == [1, 3]
  
        # init ignore private arguments
        UpperCamelCase__    :     Any        =						SampleObject(_name_or_path="lalala"		)
        UpperCamelCase__    :     str        =						obj.config
        assert config["a"] == 2
        assert config["b"] == 5
        assert config["c"] == (2, 5)
        assert config["d"] == "for diffusion"
        assert config["e"] == [1, 3]
  
        # can override default
        UpperCamelCase__    :     Dict        =						SampleObject(c=6		)
        UpperCamelCase__    :     Dict        =						obj.config
        assert config["a"] == 2
        assert config["b"] == 5
        assert config["c"] == 6
        assert config["d"] == "for diffusion"
        assert config["e"] == [1, 3]
  
        # can use positional arguments.
        UpperCamelCase__    :     int        =						SampleObject(1							,     c=6		)
        UpperCamelCase__    :     Dict        =						obj.config
        assert config["a"] == 1
        assert config["b"] == 5
        assert config["c"] == 6
        assert config["d"] == "for diffusion"
        assert config["e"] == [1, 3]
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     int		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     int        =						SampleObject()
        UpperCamelCase__    :     Any        =						obj.config
  
        assert config["a"] == 2
        assert config["b"] == 5
        assert config["c"] == (2, 5)
        assert config["d"] == "for diffusion"
        assert config["e"] == [1, 3]
  
        with tempfile.TemporaryDirectory() as tmpdirname:
             obj.save_config(SCREAMING_SNAKE_CASE		)
             UpperCamelCase__    :     Union[str, Any]        =						SampleObject.from_config(SampleObject.load_config(SCREAMING_SNAKE_CASE		)		)
             UpperCamelCase__    :     Optional[int]        =						new_obj.config
  
        # unfreeze configs
        UpperCamelCase__    :     List[Any]        =						dict(SCREAMING_SNAKE_CASE		)
        UpperCamelCase__    :     Any        =						dict(SCREAMING_SNAKE_CASE		)
  
        assert config.pop("c"		) == (2, 5)  # instantiated as tuple
        assert new_config.pop("c"		) == [2, 5]  # saved & loaded as list because of json
        config.pop("_use_default_values"		)
        assert config == new_config
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Union[str, Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[Any]        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     Optional[int]        =						DDIMScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"		)
  
        assert ddim.__class__ == DDIMScheduler
        # no warning should be thrown
        assert cap_logger.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Tuple		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Optional[Any]        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     Tuple        =						EulerDiscreteScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"		)
  
        assert euler.__class__ == EulerDiscreteScheduler
        # no warning should be thrown
        assert cap_logger.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Tuple		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[Any]        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     Any        =						EulerAncestralDiscreteScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"		)
  
        assert euler.__class__ == EulerAncestralDiscreteScheduler
        # no warning should be thrown
        assert cap_logger.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Optional[Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Any        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     str        =						PNDMScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"		)
  
        assert pndm.__class__ == PNDMScheduler
        # no warning should be thrown
        assert cap_logger.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     str		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     Union[str, Any]        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     Dict        =						DDPMScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"							,     prediction_type="sample"							,     beta_end=8							,     )
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger_a:
             UpperCamelCase__    :     str        =						DDPMScheduler.from_pretrained("google/ddpm-celebahq-256"							,     beta_start=88		)
  
        assert ddpm.__class__ == DDPMScheduler
        assert ddpm.config.prediction_type == "sample"
        assert ddpm.config.beta_end == 8
        assert ddpm_a.config.beta_start == 88
  
        # no warning should be thrown
        assert cap_logger.out == ""
        assert cap_logger_a.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     Optional[Any]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[str]        =						logging.get_logger("diffusers.configuration_utils"		)
        # 30 for warning
        logger.setLevel(30		)
  
        with CaptureLogger(SCREAMING_SNAKE_CASE		) as cap_logger:
             UpperCamelCase__    :     int        =						DPMSolverMultistepScheduler.from_pretrained(
                 "hf-internal-testing/tiny-stable-diffusion-torch"							,     subfolder="scheduler"		)
  
        assert dpm.__class__ == DPMSolverMultistepScheduler
        # no warning should be thrown
        assert cap_logger.out == ""
  
  
  
  
  
  
  
   def       __lowercase      (	self      :     List[str]		):
  
  
        '''simple docstring'''
  
  
  
  
  
  
        UpperCamelCase__    :     List[str]        =						SampleObject()
  
        UpperCamelCase__    :     str        =						{k: v for k, v in config.config.items() if not k.startswith("_"		)}
  
        # make sure that default config has all keys in `_use_default_values`
        assert set(config_dict.keys()		) == set(config.config._use_default_values		)
  
        with tempfile.TemporaryDirectory() as tmpdirname:
             config.save_config(SCREAMING_SNAKE_CASE		)
  
             # now loading it with SampleObject2 should put f into `_use_default_values`
             UpperCamelCase__    :     Dict        =						SampleObjecta.from_config(SCREAMING_SNAKE_CASE		)
  
             assert "f" in config._use_default_values
             assert config.f == [1, 3]
  
        # now loading the config, should **NOT** use [1, 3] for `f`, but the default [1, 4] value
        # **BECAUSE** it is part of `config._use_default_values`
        UpperCamelCase__    :     Dict        =						SampleObjecta.from_config(config.config		)
        assert new_config.f == [5, 4]
  
        config.config._use_default_values.pop()
        UpperCamelCase__    :     Tuple        =						SampleObjecta.from_config(config.config		)
        assert new_config_a.f == [1, 3]
  
        # Nevertheless "e" should still be correctly loaded to [1, 3] from SampleObject2 instead of defaulting to [1, 5]
        assert new_config_a.e == [1, 3]
style_context: 
  
  
  
  
  
  
  from __future__ import annotations
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			list[int]:
       if not list_of_ints:
            return []
  
       if min(__lowerCAmelCase    ) < 0:
            raise ValueError("All numbers must be positive"    )
  
       UpperCamelCase__    :     Dict        =						max(len(bin(__lowerCAmelCase    )[2:]    ) for x in list_of_ints    )
       return _msd_radix_sort(__lowerCAmelCase      ,					__lowerCAmelCase    )
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase      ,					__lowerCAmelCase    )				->			list[int]:
       if bit_position == 0 or len(__lowerCAmelCase    ) in [0, 1]:
            return list_of_ints
  
       UpperCamelCase__    :     Union[str, Any]        =						[]
       UpperCamelCase__    :     Dict        =						[]
       # Split numbers based on bit at bit_position from the right
       for number in list_of_ints:
            if (number >> (bit_position - 1)) & 1:
                 # number has a one at bit bit_position
                 ones.append(__lowerCAmelCase    )
            else:
                 # number has a zero at bit bit_position
                 zeros.append(__lowerCAmelCase    )
  
      # recursively split both lists further
       UpperCamelCase__    :     str        =						_msd_radix_sort(__lowerCAmelCase      ,					bit_position - 1    )
       UpperCamelCase__    :     Optional[Any]        =						_msd_radix_sort(__lowerCAmelCase      ,					bit_position - 1    )
  
       # recombine lists
       UpperCamelCase__    :     Optional[int]        =						zeros
       res.extend(__lowerCAmelCase    )
  
       return res
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase    )				->			Dict:
       UpperCamelCase__    :     Optional[int]        =						len(__lowerCAmelCase    )
       if not list_of_ints or length == 1:
            return
  
       if min(__lowerCAmelCase    ) < 0:
            raise ValueError("All numbers must be positive"    )
  
       UpperCamelCase__    :     int        =						max(len(bin(__lowerCAmelCase    )[2:]    ) for x in list_of_ints    )
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					0      ,					__lowerCAmelCase    )
  
  
  
  
  
  
  
  def 	SCREAMING_SNAKE_CASE							(      __lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )				->			List[str]:
       if bit_position == 0 or end_index - begin_index <= 1:
            return
  
       bit_position -= 1
  
       UpperCamelCase__    :     Any        =						begin_index
       UpperCamelCase__    :     List[str]        =						end_index - 1
       while i <= j:
            UpperCamelCase__    :     Tuple        =						False
            if not (list_of_ints[i] >> bit_position) & 1:
                 # found zero at the beginning
                 i += 1
                 UpperCamelCase__    :     Any        =						True
            if (list_of_ints[j] >> bit_position) & 1:
                 # found one at the end
                 j -= 1
                 UpperCamelCase__    :     Dict        =						True
  
            if changed:
                 continue
  
            UpperCamelCase__       ,  UpperCamelCase__    :     Any        =						list_of_ints[j], list_of_ints[i]
            j -= 1
            if j != i:
                 i += 1
  
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )
       _msd_radix_sort_inplace(__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase      ,					__lowerCAmelCase    )
  
  
  if __name__ == "__main__":
   import doctest
  
   doctest.testmod()