


from unittest import TestCase

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


class      lowercase__	(       __lowercase		):






  def       _UpperCAmelCase	(       self   :       Any			):




         """simple docstring"""







         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       _UpperCAmelCase	(       self   :       str			):




         """simple docstring"""







         UpperCAmelCase__					    =  {"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
         return Dataset.from_dict(_lowercase			)






  def       _UpperCAmelCase	(       self   :       str			):




         """simple docstring"""







         UpperCAmelCase__					    =  self._create_example_records()
         UpperCAmelCase__					    =  Dataset.from_list(_lowercase			)
         self.assertListEqual(dset.column_names		,    ["col_1", "col_2"]			)
         for i, r in enumerate(_lowercase			):
                self.assertDictEqual(_lowercase		,    example_records[i]			)






  def       _UpperCAmelCase	(       self   :       Optional[Any]			):




         """simple docstring"""







         UpperCAmelCase__					    =  self._create_example_records()
         UpperCAmelCase__					    =  Dataset.from_list(_lowercase			)
         UpperCAmelCase__					    =  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       _UpperCAmelCase	(       self   :       str			):  # checks what happens with missing columns




         """simple docstring"""







         UpperCAmelCase__					    =  [{"""col_1""": 1}, {"""col_2""": """x"""}]
         UpperCAmelCase__					    =  Dataset.from_list(_lowercase			)
         self.assertDictEqual(dset[0]		,    {"col_1": 1}			)
         self.assertDictEqual(dset[1]		,    {"col_1": None}			)  # NB: first record is used for columns






  def       _UpperCAmelCase	(       self   :       List[str]			):  # checks if the type can be inferred from the second record




         """simple docstring"""







         UpperCAmelCase__					    =  [{"""col_1""": []}, {"""col_1""": [1, 2]}]
         UpperCAmelCase__					    =  Dataset.from_list(_lowercase			)
         self.assertEqual(dset.info.features["col_1"]		,    Sequence(Value("int64"			)			)			)






  def       _UpperCAmelCase	(       self   :       int			):




         """simple docstring"""







         UpperCAmelCase__					    =  Dataset.from_list([]			)
         self.assertEqual(len(_lowercase			)		,    0			)
         self.assertListEqual(dset.column_names		,    []			)












'''simple docstring'''






import os

from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home


__UpperCamelCase					    =	HUGGINGFACE_HUB_CACHE


__UpperCamelCase					    =	"config.json"
__UpperCamelCase					    =	"diffusion_pytorch_model.bin"
__UpperCamelCase					    =	"diffusion_flax_model.msgpack"
__UpperCamelCase					    =	"model.onnx"
__UpperCamelCase					    =	"diffusion_pytorch_model.safetensors"
__UpperCamelCase					    =	"weights.pb"
__UpperCamelCase					    =	"https://huggingface.co"
__UpperCamelCase					    =	default_cache_path
__UpperCamelCase					    =	"diffusers_modules"
__UpperCamelCase					    =	os.getenv("HF_MODULES_CACHE", os.path.join(hf_cache_home, "modules"))
__UpperCamelCase					    =	["fp16", "non-ema"]
__UpperCamelCase					    =	".self_attn"


