






from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset



class 							SCREAMING_SNAKE_CASE__		(       UpperCamelCase_		):





					"""simple docstring"""






					def  _lowercase  (      self  :						Any ):
						return [
						    {"col_1": 3, "col_2": "a"},
						    {"col_1": 2, "col_2": "b"},
						    {"col_1": 1, "col_2": "c"},
						    {"col_1": 0, "col_2": "d"},
						]



					def  _lowercase  (      self  :						Tuple ):
						snake_case__				:   Optional[int]     =						{"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
						return Dataset.from_dict(_a )



					def  _lowercase  (      self  :						int ):
						snake_case__				:   str     =						self._create_example_records()
						snake_case__				:   Tuple     =						Dataset.from_list(_a )
						self.assertListEqual(dset.column_names							,	["col_1", "col_2"] )
						for i, r in enumerate(_a ):
							self.assertDictEqual(_a							,	example_records[i] )



					def  _lowercase  (      self  :						Tuple ):
						snake_case__				:   List[str]     =						self._create_example_records()
						snake_case__				:   Tuple     =						Dataset.from_list(_a )
						snake_case__				:   Any     =						Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]} )
						self.assertEqual(dset.info							,	dset_from_dict.info )



					def  _lowercase  (      self  :						str ):  # checks what happens with missing columns
						snake_case__				:   List[str]     =						[{"""col_1""": 1}, {"""col_2""": """x"""}]
						snake_case__				:   Optional[int]     =						Dataset.from_list(_a )
						self.assertDictEqual(dset[0]							,	{"col_1": 1} )
						self.assertDictEqual(dset[1]							,	{"col_1": None} )  # NB: first record is used for columns



					def  _lowercase  (      self  :						Optional[Any] ):  # checks if the type can be inferred from the second record
						snake_case__				:   Union[str, Any]     =						[{"""col_1""": []}, {"""col_1""": [1, 2]}]
						snake_case__				:   List[str]     =						Dataset.from_list(_a )
						self.assertEqual(dset.info.features["col_1"]							,	Sequence(Value("int64" ) ) )






					def  _lowercase  (      self  :						Any ):
						snake_case__				:   Union[str, Any]     =						Dataset.from_list([] )
						self.assertEqual(len(_a )							,	0 )
						self.assertListEqual(dset.column_names							,	[] )









from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
	if not (is_transformers_available() and is_torch_available()):
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	from ...utils.dummy_torch_and_transformers_objects import KandinskyPipeline, KandinskyPriorPipeline
else:
	from .pipeline_kandinsky import KandinskyPipeline
	from .pipeline_kandinsky_imgaimg import KandinskyImgaImgPipeline
	from .pipeline_kandinsky_inpaint import KandinskyInpaintPipeline
	from .pipeline_kandinsky_prior import KandinskyPriorPipeline, KandinskyPriorPipelineOutput
	from .text_encoder import MultilingualCLIP



