




import unittest
from dataclasses import dataclass
from typing import List, Union

import numpy as np
import PIL.Image

from diffusers.utils.outputs import BaseOutput







@dataclass
class 				UpperCAmelCase(					snake_case_					):



	"""simple docstring"""






	a     : Union[List[PIL.Image.Image], np.ndarray]







class 				UpperCAmelCase(					unittest.TestCase					):



	"""simple docstring"""






	def    __a     (					self    ) ->      Any:





								"""simple docstring"""


								lowercase__  :	str        =							CustomOutput(images=np.random.rand(1	,				3	,				4	,				4    )    )

								# check every way of getting the attribute
								assert isinstance(outputs.images	,				np.ndarray    )
								assert outputs.images.shape == (1, 3, 4, 4)
								assert isinstance(outputs["images"]	,				np.ndarray    )
								assert outputs["images"].shape == (1, 3, 4, 4)
								assert isinstance(outputs[0]	,				np.ndarray    )
								assert outputs[0].shape == (1, 3, 4, 4)

								# test with a non-tensor attribute
								lowercase__  :	Optional[int]        =							CustomOutput(images=[PIL.Image.new("RGB"	,				(4, 4)    )]    )

								# check every way of getting the attribute
								assert isinstance(outputs.images	,				lowerCamelCase    )
								assert isinstance(outputs.images[0]	,				PIL.Image.Image    )
								assert isinstance(outputs["images"]	,				lowerCamelCase    )
								assert isinstance(outputs["images"][0]	,				PIL.Image.Image    )
								assert isinstance(outputs[0]	,				lowerCamelCase    )
								assert isinstance(outputs[0][0]	,				PIL.Image.Image    )







	def    __a     (					self    ) ->      int:





								"""simple docstring"""


								lowercase__  :	Union[str, Any]        =							CustomOutput({"images": np.random.rand(1	,				3	,				4	,				4    )}    )

								# check every way of getting the attribute
								assert isinstance(outputs.images	,				np.ndarray    )
								assert outputs.images.shape == (1, 3, 4, 4)
								assert isinstance(outputs["images"]	,				np.ndarray    )
								assert outputs["images"].shape == (1, 3, 4, 4)
								assert isinstance(outputs[0]	,				np.ndarray    )
								assert outputs[0].shape == (1, 3, 4, 4)

								# test with a non-tensor attribute
								lowercase__  :	Optional[Any]        =							CustomOutput({"images": [PIL.Image.new("RGB"	,				(4, 4)    )]}    )

								# check every way of getting the attribute
								assert isinstance(outputs.images	,				lowerCamelCase    )
								assert isinstance(outputs.images[0]	,				PIL.Image.Image    )
								assert isinstance(outputs["images"]	,				lowerCamelCase    )
								assert isinstance(outputs["images"][0]	,				PIL.Image.Image    )
								assert isinstance(outputs[0]	,				lowerCamelCase    )
								assert isinstance(outputs[0][0]	,				PIL.Image.Image    )





def  snake_case_					(		SCREAMING_SNAKE_CASE_    )      ->			list:
							lowercase__  :	Optional[Any]        =							len(SCREAMING_SNAKE_CASE_    )

							# Set the gap value to be decreased by a factor of 1.3
							# after each iteration
							lowercase__  :	Tuple        =							1.3

							# Continue sorting until the gap is 1
							while gap > 1:
														# Decrease the gap value
														lowercase__  :	Tuple        =							int(gap / shrink    )

														# Sort the elements using insertion sort
														for i in range(SCREAMING_SNAKE_CASE_    ,len(SCREAMING_SNAKE_CASE_    )    ):
																					lowercase__  :	int        =							collection[i]
																					lowercase__  :	Union[str, Any]        =							i
																					while j >= gap and collection[j - gap] > temp:
																												lowercase__  :	str        =							collection[j - gap]
																												j -= gap
																					lowercase__  :	List[Any]        =							temp

							return collection


if __name__ == "__main__":
						import doctest

						doctest.testmod()