




import json
import os
import pickle
import subprocess
from hashlib import mda
from pathlib import Path
from tempfile import gettempdir
from textwrap import dedent
from types import CodeType, FunctionType
from unittest import TestCase
from unittest.mock import patch

import pytest
from multiprocess import Pool
from packaging import version

import datasets
from datasets.fingerprint import Hasher, fingerprint_transform
from datasets.table import InMemoryTable

from .utils import (
    require_regex,
    require_spacy,
    require_spacy_model,
    require_tiktoken,
    require_torch,
    require_transformers,
)

class 		lowercase_       :




					def __init__(   self:		Any,     _lowercase:		str):


									'''simple docstring'''


									__lowerCAmelCase					=  foo







					def __call__(   self:		Union[str, Any]):


									'''simple docstring'''


									return self.foo





class 		lowercase_       (	datasets.Dataset				):




					@fingerprint_transform(inplace=_lowercase)
					def     _lowercase						(   self:		List[Any],     _lowercase:		List[str],     *_lowercase:		Optional[int],     **_lowercase:		List[Any]):


									'''simple docstring'''


									return DatasetChild(self.data,     fingerprint=_lowercase)







					@fingerprint_transform(inplace=_lowercase)
					def     _lowercase						(   self:		Optional[int],     _lowercase:		Optional[int],     *_lowercase:		int,     **_lowercase:		Optional[int]):


									'''simple docstring'''


									return DatasetChild(self.data,     fingerprint=_lowercase)





class 		lowercase_       :




					def __init__(   self:		str,     _lowercase:		Optional[Any]):


									'''simple docstring'''


									__lowerCAmelCase					=  callable




					def __call__(   self:		Optional[Any],     *_lowercase:		Dict,     **_lowercase:		str):


									'''simple docstring'''


									if self.callable is not None:
													return self.callable(*_lowercase,     **_lowercase)







					def __getstate__(   self:		Optional[Any]):


									'''simple docstring'''


									raise pickle.PicklingError()





class 		lowercase_       (	lowerCAmelCase__				):




					@require_transformers
					@pytest.mark.integration
					def     _lowercase						(   self:		str):


									'''simple docstring'''


									from transformers import AutoTokenizer

									def encode(_lowercase:		int):
													return tokenizer(_lowercase)

									# TODO: add hash consistency tests across sessions
									__lowerCAmelCase					=  AutoTokenizer.from_pretrained("""bert-base-uncased""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(lambda _lowercase: tokenizer(_lowercase))).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  AutoTokenizer.from_pretrained("""bert-base-cased""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(lambda _lowercase: tokenizer(_lowercase))).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  AutoTokenizer.from_pretrained("""bert-base-uncased""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(lambda _lowercase: tokenizer(_lowercase))).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					@require_transformers
					@pytest.mark.integration
					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


									from transformers import AutoTokenizer

									__lowerCAmelCase					=  AutoTokenizer.from_pretrained("""gpt2""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									tokenizer("""Hello world !""")  # call once to change the tokenizer's cache
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)







					@require_regex
					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									import regex

									__lowerCAmelCase					=  regex.Regex("""foo""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  regex.Regex("""bar""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  regex.Regex("""foo""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)





class 		lowercase_       (	lowerCAmelCase__				):




					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


									def func():
													return foo

									__lowerCAmelCase					=  [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  [1]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									def func():
													pass

									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()

									def func():
													pass

									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([0]))).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([1]))).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([0]))).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		List[Any]):


									'''simple docstring'''


									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([0]).__call__)).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([1]).__call__)).hexdigest()
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(Foo([0]).__call__)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		str):


									'''simple docstring'''


									__lowerCAmelCase					=  (
									    """co_argcount""",
									    """co_kwonlyargcount""",
									    """co_nlocals""",
									    """co_stacksize""",
									    """co_flags""",
									    """co_code""",
									    """co_consts""",
									    """co_names""",
									    """co_varnames""",
									    """co_filename""",
									    """co_name""",
									    """co_firstlineno""",
									    """co_lnotab""",
									    """co_freevars""",
									    """co_cellvars""",
									)

									def _create_code_pyaa(*_lowercase:		Any):
													if hasattr(args[-3],     """encode"""):
																	__lowerCAmelCase					=  list(_lowercase)
																	__lowerCAmelCase					=  args[-3].encode()  # co_lnotab
																	__lowerCAmelCase					=  args[-10].encode()  # co_code
													if hasattr(_lowercase,     """co_posonlyargcount"""):
																	if len(_lowercase) == 16:
																					return CodeType(*_lowercase)
																	elif len(_lowercase) == 15:
																					return CodeType(args[0],     0,     *args[1:])
																	return CodeType(args[0],     0,     0,     *args[1:])
													elif hasattr(_lowercase,     """co_kwonlyargcount"""):
																	if len(_lowercase) == 16:
																					return CodeType(args[0],     *args[2:])
																	elif len(_lowercase) == 15:
																					return CodeType(*_lowercase)
																	return CodeType(args[0],     0,     *args[1:])
													if len(_lowercase) == 16:
																	return CodeType(args[0],     *args[3:])
													elif len(_lowercase) == 15:
																	return CodeType(args[0],     *args[2:])
													return CodeType(*_lowercase)

									def create_ipython_func(_lowercase:		Dict,     _lowercase:		List[str]):
													def func():
																	return returned_obj

													__lowerCAmelCase					=  func.__code__
													# Use _create_code from dill in order to make it work for different python versions
													if datasets.config.PY_VERSION < version.parse("""3.8"""):
																	__lowerCAmelCase					=  _create_code_pyaa(
																	    *[getattr(_lowercase,     _lowercase) if k != """co_filename""" else co_filename for k in code_args_pyaa])
													else:
																	__lowerCAmelCase					=  code.replace(co_filename=_lowercase)
													return FunctionType(_lowercase,     func.__globals__,     func.__name__,     func.__defaults__,     func.__closure__)

									__lowerCAmelCase	,				__lowerCAmelCase					=  """<ipython-input-2-e0383a102aae>""", [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									__lowerCAmelCase	,				__lowerCAmelCase					=  """<ipython-input-2-e0383a102aae>""", [1]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									__lowerCAmelCase	,				__lowerCAmelCase					=  """<ipython-input-5-713f6613acf3>""", [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)

									__lowerCAmelCase	,				__lowerCAmelCase					=  os.path.join(gettempdir(),     """ipykernel_12345""",     """321456789.py"""), [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									__lowerCAmelCase	,				__lowerCAmelCase					=  os.path.join(gettempdir(),     """ipykernel_12345""",     """321456789.py"""), [1]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									__lowerCAmelCase	,				__lowerCAmelCase					=  os.path.join(gettempdir(),     """ipykernel_12345""",     """654123987.py"""), [0]
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(create_ipython_func(_lowercase,     _lowercase))).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)







					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


									__lowerCAmelCase	,				__lowerCAmelCase					=  [0], [1]

									def func():
													return foo, bar

									__lowerCAmelCase					=  """__main__"""

									def globalvars_mocka_side_effect(_lowercase:		int,     *_lowercase:		Any,     **_lowercase:		Union[str, Any]):
													return {"foo": foo, "bar": bar}

									def globalvars_mocka_side_effect(_lowercase:		List[Any],     *_lowercase:		Optional[int],     **_lowercase:		Dict):
													return {"bar": bar, "foo": foo}

									with patch("""dill.detect.globalvars""",     side_effect=_lowercase) as globalvars_mocka:
													__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
													self.assertGreater(globalvars_mocka.call_count,     0)
									with patch("""dill.detect.globalvars""",     side_effect=_lowercase) as globalvars_mocka:
													__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
													self.assertGreater(globalvars_mocka.call_count,     0)
									self.assertEqual(_lowercase,     _lowercase)





class 		lowercase_       (	lowerCAmelCase__				):




					def     _lowercase						(   self:		Union[str, Any]):


									'''simple docstring'''


									__lowerCAmelCase					=  Hasher.hash("""hello""")
									__lowerCAmelCase					=  Hasher.hash("""hello""")
									__lowerCAmelCase					=  Hasher.hash("""there""")
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		str):


									'''simple docstring'''


									__lowerCAmelCase					=  Hasher.hash(Foo("""hello"""))
									__lowerCAmelCase					=  Hasher.hash(Foo("""hello"""))
									__lowerCAmelCase					=  Hasher.hash(Foo("""there"""))
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		Dict):


									'''simple docstring'''


									__lowerCAmelCase					=  Hasher()
									for x in ["hello", Foo("""hello""")]:
													hasher.update(_lowercase)
									__lowerCAmelCase					=  hasher.hexdigest()
									__lowerCAmelCase					=  Hasher()
									for x in ["hello", Foo("""hello""")]:
													hasher.update(_lowercase)
									__lowerCAmelCase					=  hasher.hexdigest()
									__lowerCAmelCase					=  Hasher()
									for x in ["there", Foo("""there""")]:
													hasher.update(_lowercase)
									__lowerCAmelCase					=  hasher.hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


									with self.assertRaises(pickle.PicklingError):
													Hasher.hash(UnpicklableCallable(Foo("""hello""")))




					def     _lowercase						(   self:		Tuple):


									'''simple docstring'''


									__lowerCAmelCase					=  """abc"""
									__lowerCAmelCase					=  [string, string]  # two strings have the same ids
									__lowerCAmelCase					=  [string, string]
									__lowerCAmelCase					=  json.loads(f'''["{string}", "{string}"]''')  # two strings have different ids
									self.assertIs(obja[0],     _lowercase)
									self.assertIs(obja[0],     obja[1])
									self.assertIs(obja[0],     _lowercase)
									self.assertIs(obja[0],     obja[1])
									self.assertIsNot(obja[0],     _lowercase)
									self.assertIsNot(obja[0],     obja[1])
									__lowerCAmelCase					=  Hasher.hash(_lowercase)
									__lowerCAmelCase					=  Hasher.hash(_lowercase)
									__lowerCAmelCase					=  Hasher.hash(_lowercase)
									self.assertEqual(_lowercase,     _lowercase)
									self.assertEqual(_lowercase,     _lowercase)




					@require_tiktoken
					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


									import tiktoken

									__lowerCAmelCase					=  tiktoken.get_encoding("""gpt2""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  tiktoken.get_encoding("""r50k_base""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  tiktoken.get_encoding("""gpt2""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)




					@require_torch
					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									import torch

									__lowerCAmelCase					=  torch.tensor([1.0])
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  torch.tensor([2.0])
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  torch.tensor([1.0])
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)







					@require_spacy
					@require_spacy_model("""en_core_web_sm""")
					@require_spacy_model("""fr_core_news_sm""")
					@pytest.mark.integration
					def     _lowercase						(   self:		Optional[int]):


									'''simple docstring'''


									import spacy

									__lowerCAmelCase					=  spacy.load("""en_core_web_sm""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  spacy.load("""fr_core_news_sm""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									__lowerCAmelCase					=  spacy.load("""en_core_web_sm""")
									__lowerCAmelCase					=  mda(datasets.utils.py_utils.dumps(_lowercase)).hexdigest()
									self.assertEqual(_lowercase,     _lowercase)
									self.assertNotEqual(_lowercase,     _lowercase)





@pytest.mark.integration
def      UpperCAmelCase  (						UpperCamelCase__   )     ->     Optional[int]:







				'''simple docstring'''


				__lowerCAmelCase					=  tmp_path / """dir1"""
				__lowerCAmelCase					=  tmp_path / """dir2"""
				dira.mkdir()
				dira.mkdir()
				__lowerCAmelCase					=  """script.py"""
				__lowerCAmelCase					=  dedent(
				    """
    from datasets.fingerprint import Hasher
    def foo():
        pass
    print(Hasher.hash(foo))
    """   )
				__lowerCAmelCase					=  dira / script_filename
				__lowerCAmelCase					=  dira / script_filename
				with script_patha.open("""w"""   ) as f:
								f.write(UpperCamelCase__   )
				with script_patha.open("""w"""   ) as f:
								f.write(UpperCamelCase__   )
				__lowerCAmelCase					=  subprocess.check_output(["""python""", str(UpperCamelCase__   )]   )
				__lowerCAmelCase					=  subprocess.check_output(["""python""", str(UpperCamelCase__   )]   )
				assert fingerprinta == fingerprinta





def      UpperCAmelCase  (						)     ->     Tuple:







				'''simple docstring'''


				__lowerCAmelCase					=  {"""a""": [0, 1, 2]}
				__lowerCAmelCase					=  DatasetChild(InMemoryTable.from_pydict(UpperCamelCase__   )   )
				__lowerCAmelCase					=  dataset.funca()._fingerprint
				assert expected_fingerprint == dataset.funca()._fingerprint
				assert expected_fingerprint != dataset.funca()._fingerprint

				with Pool(2   ) as p:
								assert expected_fingerprint == p.apply_async(dataset.funca   ).get()._fingerprint
								assert expected_fingerprint != p.apply_async(dataset.funca   ).get()._fingerprint





def      UpperCAmelCase  (						)     ->     List[Any]:







				'''simple docstring'''


				__lowerCAmelCase					=  {"""a""": [0, 1, 2]}

				class 		lowercase_       (	datasets.Dataset				):




									@fingerprint_transform(inplace=_lowercase)
									def     _lowercase						(   self:		Any,     _lowercase:		Any):


													'''simple docstring'''


													return DummyDatasetChild(self.data,     fingerprint=_lowercase)





				__lowerCAmelCase					=  DummyDatasetChild(InMemoryTable.from_pydict(UpperCamelCase__   )   ).func()

				class 		lowercase_       (	datasets.Dataset				):




									@fingerprint_transform(inplace=_lowercase,     version="""1.0.0""")
									def     _lowercase						(   self:		List[str],     _lowercase:		Optional[Any]):


													'''simple docstring'''


													return DummyDatasetChild(self.data,     fingerprint=_lowercase)





				__lowerCAmelCase					=  DummyDatasetChild(InMemoryTable.from_pydict(UpperCamelCase__   )   ).func()

				class 		lowercase_       (	datasets.Dataset				):




									@fingerprint_transform(inplace=_lowercase,     version="""2.0.0""")
									def     _lowercase						(   self:		str,     _lowercase:		Optional[int]):


													'''simple docstring'''


													return DummyDatasetChild(self.data,     fingerprint=_lowercase)





				__lowerCAmelCase					=  DummyDatasetChild(InMemoryTable.from_pydict(UpperCamelCase__   )   ).func()

				assert len({fingeprint_no_version, fingeprint_a, fingeprint_a}   ) == 3





def      UpperCAmelCase  (						)     ->     int:







				'''simple docstring'''


				__lowerCAmelCase					=  Hasher()
				hasher.update(lambda UpperCamelCase__   : x   )











import re
import tempfile
import unittest
from pathlib import Path

from datasets.utils.metadata import DatasetMetadata





def      UpperCAmelCase  (						UpperCamelCase__   )     ->     str:







				'''simple docstring'''


				__lowerCAmelCase					=  min(re.search("""^ +"""						,			UpperCamelCase__   ).end() if t.startswith(""" """   ) else 0 for t in string.splitlines()   )
				return "\n".join([line[indent_level:] for line in string.splitlines() if indent_level < len(UpperCamelCase__   )]   )


__A						:		str          =						"\\n---\nlanguage:\n- zh\n- en\ntask_ids:\n- sentiment-classification\n---\n# Begin of markdown\n\nSome cool dataset card\n"

__A						:		int          =						"\\n---\n---\n# Begin of markdown\n\nSome cool dataset card\n"


__A						:		Any          =						"\\n# Begin of markdown\n\nSome cool dataset card\n"

class 		lowercase_       (	unittest.TestCase				):




					def     _lowercase						(   self:		List[str]):


									'''simple docstring'''


									with tempfile.TemporaryDirectory() as tmp_dir:
													__lowerCAmelCase					=  Path(_lowercase) / """README.md"""
													with open(_lowercase,     """w+""") as readme_file:
																	readme_file.write(_lowercase)
													__lowerCAmelCase					=  DatasetMetadata.from_readme(_lowercase)
													self.assertDictEqual(_lowercase,     {"""language""": ["""zh""", """en"""], """task_ids""": ["""sentiment-classification"""]})

													with open(_lowercase,     """w+""") as readme_file:
																	readme_file.write(_lowercase)
													__lowerCAmelCase					=  DatasetMetadata.from_readme(_lowercase)
													self.assertDictEqual(_lowercase,     {})

													with open(_lowercase,     """w+""") as readme_file:
																	readme_file.write(_lowercase)
													__lowerCAmelCase					=  DatasetMetadata.from_readme(_lowercase)
													self.assertEqual(_lowercase,     {})







					def     _lowercase						(   self:		Optional[Any]):


									'''simple docstring'''


									__lowerCAmelCase					=  _dedent(
									    """\
            annotations_creators:
            - found
            language_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - question-answering
            task_ids:
            - open-domain-qa
            """)
									assert DatasetMetadata.from_yaml_string(_lowercase)

									__lowerCAmelCase					=  _dedent(
									    """\
            annotations_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - question-answering
            task_ids:
            - open-domain-qa
            task_ids:
            - open-domain-qa
            """)
									with self.assertRaises(_lowercase):
													DatasetMetadata.from_yaml_string(_lowercase)

									__lowerCAmelCase					=  _dedent(
									    """\
            annotations_creators:
            - found
            language_creators:
            - found
            language:
            - en
            license:
            - unknown
            multilinguality:
            - monolingual
            pretty_name: Test Dataset
            size_categories:
            - 10K<n<100K
            source_datasets:
            - extended|other-yahoo-webscope-l6
            task_categories:
            - text-classification
            task_ids:
            - multi-class-classification
            paperswithcode_id:
            - squad
            configs:
            - en
            train-eval-index:
            - config: en
              task: text-classification
              task_id: multi_class_classification
              splits:
                train_split: train
                eval_split: test
              col_mapping:
                text: text
                label: target
              metrics:
                - type: accuracy
                  name: Accuracy
            extra_gated_prompt: |
              By clicking on “Access repository” below, you also agree to ImageNet Terms of Access:
              [RESEARCHER_FULLNAME] (the \"Researcher\") has requested permission to use the ImageNet database (the \"Database\") at Princeton University and Stanford University. In exchange for such permission, Researcher hereby agrees to the following terms and conditions:
              1. Researcher shall use the Database only for non-commercial research and educational purposes.
            extra_gated_fields:
              Company: text
              Country: text
              I agree to use this model for non-commerical use ONLY: checkbox
            """)
									assert DatasetMetadata.from_yaml_string(_lowercase)





