





'''simple docstring'''






import os

import pytest

from datasets import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
)


lowerCAmelCase									=   pytest.mark.integration






@pytest.mark.parametrize("path"   ,["paws", "csv"]						)
def   __A    (				a_    :	Tuple   ,a_    :	Optional[int]						):
		inspect_dataset(a_   ,a_						)
		lowerCAmelCase  :     int       						= path + ".py"
		assert script_name in os.listdir(a_						)
		assert "__pycache__" not in os.listdir(a_						)






@pytest.mark.filterwarnings("ignore:inspect_metric is deprecated:FutureWarning"						)
@pytest.mark.filterwarnings("ignore:metric_module_factory is deprecated:FutureWarning"						)
@pytest.mark.parametrize("path"   ,["accuracy"]						)
def   __A    (				a_    :	Optional[int]   ,a_    :	List[str]						):
		inspect_metric(a_   ,a_						)
		lowerCAmelCase  :     List[Any]       						= path + ".py"
		assert script_name in os.listdir(a_						)
		assert "__pycache__" not in os.listdir(a_						)






@pytest.mark.parametrize(
    "path, config_name, expected_splits"   ,[
        ("squad", "plain_text", ["train", "validation"]),
        ("dalle-mini/wit", "dalle-mini--wit", ["train"]),
        ("paws", "labeled_final", ["train", "test", "validation"]),
    ]   ,)
def   __A    (				a_    :	List[str]   ,a_    :	Tuple   ,a_    :	List[str]						):
		lowerCAmelCase  :     List[str]       						= get_dataset_config_info(a_   ,config_name=a_						)
		assert info.config_name == config_name
		assert list(info.splits.keys()						) == expected_splits






@pytest.mark.parametrize(
    "path, config_name, expected_exception"   ,[
        ("paws", None, ValueError),
    ]   ,)
def   __A    (				a_    :	List[str]   ,a_    :	Optional[int]   ,a_    :	Dict						):
		with pytest.raises(a_						):
				get_dataset_config_info(a_   ,config_name=a_						)






@pytest.mark.parametrize(
    "path, expected"   ,[
        ("squad", "plain_text"),
        ("acronym_identification", "default"),
        ("lhoestq/squad", "plain_text"),
        ("lhoestq/test", "default"),
        ("lhoestq/demo1", "lhoestq--demo1"),
        ("dalle-mini/wit", "dalle-mini--wit"),
    ]   ,)
def   __A    (				a_    :	Optional[int]   ,a_    :	Optional[int]						):
		lowerCAmelCase  :     str       						= get_dataset_config_names(a_						)
		assert expected in config_names






@pytest.mark.parametrize(
    "path, expected_configs, expected_splits_in_first_config"   ,[
        ("squad", ["plain_text"], ["train", "validation"]),
        ("dalle-mini/wit", ["dalle-mini--wit"], ["train"]),
        ("paws", ["labeled_final", "labeled_swap", "unlabeled_final"], ["train", "test", "validation"]),
    ]   ,)
def   __A    (				a_    :	Union[str, Any]   ,a_    :	Optional[Any]   ,a_    :	Optional[int]						):
		lowerCAmelCase  :     Optional[Any]       						= get_dataset_infos(a_						)
		assert list(infos.keys()						) == expected_configs
		lowerCAmelCase  :     List[Any]       						= expected_configs[0]
		assert expected_config in infos
		lowerCAmelCase  :     List[str]       						= infos[expected_config]
		assert info.config_name == expected_config
		assert list(info.splits.keys()						) == expected_splits_in_first_config






@pytest.mark.parametrize(
    "path, expected_config, expected_splits"   ,[
        ("squad", "plain_text", ["train", "validation"]),
        ("dalle-mini/wit", "dalle-mini--wit", ["train"]),
        ("paws", "labeled_final", ["train", "test", "validation"]),
    ]   ,)
def   __A    (				a_    :	List[str]   ,a_    :	Tuple   ,a_    :	str						):
		lowerCAmelCase  :     Union[str, Any]       						= get_dataset_infos(a_						)
		assert expected_config in infos
		lowerCAmelCase  :     Optional[Any]       						= infos[expected_config]
		assert info.config_name == expected_config
		assert list(info.splits.keys()						) == expected_splits






@pytest.mark.parametrize(
    "path, config_name, expected_exception"   ,[
        ("paws", None, ValueError),
    ]   ,)
def   __A    (				a_    :	Optional[int]   ,a_    :	Any   ,a_    :	Dict						):
		with pytest.raises(a_						):
				get_dataset_split_names(a_   ,config_name=a_						)










'''simple docstring'''






from __future__ import annotations






def   __A    (				a_    :	float   ,a_    :	float   ,a_    :	float   ,):
		if (electron_conc, hole_conc, intrinsic_conc).count(0						) != 1:
				raise ValueError("You cannot supply more or less than 2 values"						)
		elif electron_conc < 0:
				raise ValueError("Electron concentration cannot be negative in a semiconductor"						)
		elif hole_conc < 0:
				raise ValueError("Hole concentration cannot be negative in a semiconductor"						)
		elif intrinsic_conc < 0:
				raise ValueError(
				    "Intrinsic concentration cannot be negative in a semiconductor"						)
		elif electron_conc == 0:
				return (
				    "electron_conc",
				    intrinsic_conc**2 / hole_conc,
				)
		elif hole_conc == 0:
				return (
				    "hole_conc",
				    intrinsic_conc**2 / electron_conc,
				)
		elif intrinsic_conc == 0:
				return (
				    "intrinsic_conc",
				    (electron_conc * hole_conc) ** 0.5,
				)
		else:
				return (-1, -1)


if __name__ == "__main__":
					import doctest

					doctest.testmod()



