import pytest

from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested

from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows



def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: List[str]			)							->      Optional[int]:  # picklable for multiprocessing







  """simple docstring"""





  return i + 1



@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
def 			__SCREAMING_SNAKE_CASE						(      )							->      Optional[Any]:







  """simple docstring"""





  with parallel_backend("""spark"""			):
    assert ParallelBackendConfig.backend_name == "spark"

  SCREAMING_SNAKE_CASE__    							=   [1, 2, 3]
  with pytest.raises(__UpperCamelCase			):
    with parallel_backend("""unsupported backend"""			):
      map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=2			)

  with pytest.raises(__UpperCamelCase			):
    with parallel_backend("""unsupported backend"""			):
      map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=-1			)






@require_dill_gt_0_3_2
@require_joblibspark
@require_not_windows
@pytest.mark.parametrize("""num_proc"""				,  [2, -1]			)
def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: Dict			)							->      List[Any]:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__    							=   [1, 2]
  SCREAMING_SNAKE_CASE__    							=   {"""a""": 1, """b""": 2}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": [1, 2], """b""": [3, 4]}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": {"""1""": 1}, """b""": 2}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": 1, """b""": 2, """c""": 3, """d""": 4}
  SCREAMING_SNAKE_CASE__    							=   [2, 3]
  SCREAMING_SNAKE_CASE__    							=   {"""a""": 2, """b""": 3}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": [2, 3], """b""": [4, 5]}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": {"""1""": 2}, """b""": 3}
  SCREAMING_SNAKE_CASE__    							=   {"""a""": 2, """b""": 3, """c""": 4, """d""": 5}

  with parallel_backend("""spark"""			):
    assert map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=__UpperCamelCase			) == expected_map_nested_sa
    assert map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=__UpperCamelCase			) == expected_map_nested_sa
    assert map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=__UpperCamelCase			) == expected_map_nested_sa
    assert map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=__UpperCamelCase			) == expected_map_nested_sa
    assert map_nested(__UpperCamelCase				,  __UpperCamelCase				,  num_proc=__UpperCamelCase			) == expected_map_nested_sa

from math import log

from scipy.constants import Boltzmann, physical_constants

__lowerCamelCase    :				int							     =	300  # TEMPERATURE (unit = K)



def 			__SCREAMING_SNAKE_CASE						(      __UpperCamelCase					: float				,  __UpperCamelCase					: float				,  __UpperCamelCase					: float				,  )							->      float:







  """simple docstring"""





  if donor_conc <= 0:
    raise ValueError("""Donor concentration should be positive"""			)
  elif acceptor_conc <= 0:
    raise ValueError("""Acceptor concentration should be positive"""			)
  elif intrinsic_conc <= 0:
    raise ValueError("""Intrinsic concentration should be positive"""			)
  elif donor_conc <= intrinsic_conc:
    raise ValueError(
        """Donor concentration should be greater than intrinsic concentration"""			)
  elif acceptor_conc <= intrinsic_conc:
    raise ValueError(
        """Acceptor concentration should be greater than intrinsic concentration"""			)
  else:
    return (
        Boltzmann
        * T
        * log((donor_conc * acceptor_conc) / intrinsic_conc**2			)
        / physical_constants["electron volt"][0]
    )


if __name__ == "__main__":
   import doctest

   doctest.testmod()
