



'''simple docstring'''

from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
			import accelerate






def 				a  (     UpperCamelCase_    :    Optional[int]			)       ->	Any:
		if not is_accelerate_available():
				return method
		snake_case__	     =version.parse(accelerate.__version__			).base_version
		if version.parse(UpperCamelCase_			) < version.parse('0.17.0'			):
				return method

		def wrapper(self    :    str      ,					*UpperCamelCase_    :    Dict      ,					**UpperCamelCase_    :    Any			):
				if hasattr(self      ,					'_hf_hook'			) and hasattr(self._hf_hook      ,					'pre_forward'			):
						self._hf_hook.pre_forward(self			)
				return method(self      ,					*UpperCamelCase_      ,					**UpperCamelCase_			)

		return wrapper









'''simple docstring'''

from __future__ import annotations

SCREAMING_SNAKE_CASE__     :						List[Any]	=  1.6021e-19  # units = C






def 				a  (     UpperCamelCase_    :    float      ,					UpperCamelCase_    :    float      ,					UpperCamelCase_    :    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()




