



'''simple docstring'''






from __future__ import annotations

UpperCamelCase__:     Union[str, Any]										=    1.60_21E-19  # units = C


def 				snake_case_  (      _lowerCAmelCase						:		float     ,   _lowerCAmelCase						:		float     ,   _lowerCAmelCase						:		float     ,   )   ->     tuple[str, float]:
							if (conductivity, electron_conc, mobility).count(0						) != 1:
														raise ValueError('''You cannot supply more or less than 2 values'''						)
							elif conductivity < 0:
														raise ValueError('''Conductivity cannot be negative'''						)
							elif electron_conc < 0:
														raise ValueError('''Electron concentration cannot be negative'''						)
							elif mobility < 0:
														raise ValueError('''mobility cannot be negative'''						)
							elif conductivity == 0:
														return (
														    "conductivity",
														    mobility * electron_conc * ELECTRON_CHARGE,
														)
							elif electron_conc == 0:
														return (
														    "electron_conc",
														    conductivity / (mobility * ELECTRON_CHARGE),
														)
							else:
														return (
														    "mobility",
														    conductivity / (electron_conc * ELECTRON_CHARGE),
														)


if __name__ == "__main__":
						import doctest

						doctest.testmod()










'''simple docstring'''






import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict


@pytest.mark.parametrize(
    '''split_dict'''     ,   [
        SplitDict(),
        SplitDict({'''train''': SplitInfo(name='''train'''     ,   num_bytes=1337     ,   num_examples=42     ,   dataset_name='''my_dataset'''						)}						),
        SplitDict({'''train''': SplitInfo(name='''train'''     ,   num_bytes=1337     ,   num_examples=42						)}						),
        SplitDict({'''train''': SplitInfo()}						),
    ]     ,   )
def 				snake_case_  (      _lowerCAmelCase						:		SplitDict						)   ->     List[Any]:
							UpperCAmelCase				: str											=	split_dict._to_yaml_list()
							assert len(_lowerCAmelCase						) == len(_lowerCAmelCase						)
							UpperCAmelCase				: Optional[int]											=	SplitDict._from_yaml_list(_lowerCAmelCase						)
							for split_name, split_info in split_dict.items():
														# dataset_name field is deprecated, and is therefore not part of the YAML dump
														UpperCAmelCase				: Optional[Any]											=	None
														# the split name of split_dict takes over the name of the split info object
														UpperCAmelCase				: Dict											=	split_name
							assert split_dict == reloaded




@pytest.mark.parametrize(
    '''split_info'''     ,   [SplitInfo(), SplitInfo(dataset_name=_lowerCAmelCase						), SplitInfo(dataset_name='''my_dataset'''						)]						)
def 				snake_case_  (      _lowerCAmelCase						:		List[Any]						)   ->     Optional[Any]:
							# For backward compatibility, we need asdict(split_dict) to return split info dictrionaries with the "dataset_name"
							# field even if it's deprecated. This way old versionso of `datasets` can still reload dataset_infos.json files
							UpperCAmelCase				: Any											=	asdict(SplitDict({'''train''': split_info}						)						)
							assert "dataset_name" in split_dict_asdict["train"]
							assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name





