import re
import tempfile
import unittest
from pathlib import Path

from datasets.utils.metadata import DatasetMetadata






def  UpperCAmelCase__(    lowerCamelCase_	):



			"""simple docstring"""





			_snake_case														=   min(re.search("^ +"				,						lowerCamelCase_	).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(lowerCamelCase_	)]	)


_SCREAMING_SNAKE_CASE:    Union[str, Any]     						=							'''\
---
language:
- zh
- en
task_ids:
- sentiment-classification
---
# Begin of markdown

Some cool dataset card
'''

_SCREAMING_SNAKE_CASE:    Dict     						=							'''\
---
---
# Begin of markdown

Some cool dataset card
'''


_SCREAMING_SNAKE_CASE:    Dict     						=							'''\
# Begin of markdown

Some cool dataset card
'''







class 						_SCREAMING_SNAKE_CASE				(  unittest.TestCase				):






		"""simple docstring"""







		def 					_a					(      self     :					Optional[Any] ):






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

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

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







		def 					_a					(      self     :					List[Any] ):






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

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

					_snake_case														=   _dedent(
					    "\\n            annotations_creators:\n            - found\n            language_creators:\n            - found\n            language:\n            - en\n            license:\n            - unknown\n            multilinguality:\n            - monolingual\n            pretty_name: Test Dataset\n            size_categories:\n            - 10K<n<100K\n            source_datasets:\n            - extended|other-yahoo-webscope-l6\n            task_categories:\n            - text-classification\n            task_ids:\n            - multi-class-classification\n            paperswithcode_id:\n            - squad\n            configs:\n            - en\n            train-eval-index:\n            - config: en\n              task: text-classification\n              task_id: multi_class_classification\n              splits:\n                train_split: train\n                eval_split: test\n              col_mapping:\n                text: text\n                label: target\n              metrics:\n                - type: accuracy\n                  name: Accuracy\n            extra_gated_prompt: |\n              By clicking on “Access repository” below, you also agree to ImageNet Terms of Access:\n              [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:\n              1. Researcher shall use the Database only for non-commercial research and educational purposes.\n            extra_gated_fields:\n              Company: text\n              Country: text\n              I agree to use this model for non-commerical use ONLY: checkbox\n            " )
					assert DatasetMetadata.from_yaml_string(__SCREAMING_SNAKE_CASE )


from __future__ import annotations

# Define the Gravitational Constant G and the function
_SCREAMING_SNAKE_CASE:    int     						=							6.6_743e-11  # unit of G : m^3 * kg^-1 * s^-2






def  UpperCAmelCase__(    lowerCamelCase_				,						lowerCamelCase_				,						lowerCamelCase_				,						lowerCamelCase_	):



			"""simple docstring"""





			_snake_case														=   mass_a * mass_a

			if (force, mass_a, mass_a, distance).count(0	) != 1:
						raise ValueError("One and only one argument must be 0"	)
			if force < 0:
						raise ValueError("Gravitational force can not be negative"	)
			if distance < 0:
						raise ValueError("Distance can not be negative"	)
			if mass_a < 0 or mass_a < 0:
						raise ValueError("Mass can not be negative"	)
			if force == 0:
						_snake_case														=   GRAVITATIONAL_CONSTANT * product_of_mass / (distance**2)
						return {"force": force}
			elif mass_a == 0:
						_snake_case														=   (force) * (distance**2) / (GRAVITATIONAL_CONSTANT * mass_a)
						return {"mass_1": mass_a}
			elif mass_a == 0:
						_snake_case														=   (force) * (distance**2) / (GRAVITATIONAL_CONSTANT * mass_a)
						return {"mass_2": mass_a}
			elif distance == 0:
						_snake_case														=   (GRAVITATIONAL_CONSTANT * product_of_mass / (force)) ** 0.5
						return {"distance": distance}
			raise ValueError("One and only one argument must be 0"	)


# Run doctest
if __name__ == "__main__":
			import doctest

			doctest.testmod()

