

from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset





class  __UpperCAmelCase					(	lowerCamelCase__						):



   def 	__magic_name__   (							self							:					Any						):
     return [
         {"col_1": 3, "col_2": "a"},
         {"col_1": 2, "col_2": "b"},
         {"col_1": 1, "col_2": "c"},
         {"col_1": 0, "col_2": "d"},
     ]



   def 	__magic_name__   (							self							:					int						):
     UpperCAmelCase	:							Union[str, Any]						=			{'''col_1''': [3, 2, 1, 0], '''col_2''': ['''a''', '''b''', '''c''', '''d''']}
     return Dataset.from_dict(__A						)



   def 	__magic_name__   (							self							:					Optional[int]						):
     UpperCAmelCase	:							Union[str, Any]						=			self._create_example_records()
     UpperCAmelCase	:							Dict						=			Dataset.from_list(__A						)
     self.assertListEqual(dset.column_names,		['''col_1''', '''col_2''']						)
     for i, r in enumerate(__A						):
       self.assertDictEqual(__A,		example_records[i]						)



   def 	__magic_name__   (							self							:					Optional[Any]						):
     UpperCAmelCase	:							int						=			self._create_example_records()
     UpperCAmelCase	:							List[Any]						=			Dataset.from_list(__A						)
     UpperCAmelCase	:							Any						=			Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}						)
     self.assertEqual(dset.info,		dset_from_dict.info						)



   def 	__magic_name__   (							self							:					Dict						):  # checks what happens with missing columns
     UpperCAmelCase	:							Dict						=			[{'''col_1''': 1}, {'''col_2''': '''x'''}]
     UpperCAmelCase	:							Optional[Any]						=			Dataset.from_list(__A						)
     self.assertDictEqual(dset[0],		{'''col_1''': 1}						)
     self.assertDictEqual(dset[1],		{'''col_1''': None}						)  # NB: first record is used for columns



   def 	__magic_name__   (							self							:					Optional[int]						):  # checks if the type can be inferred from the second record
     UpperCAmelCase	:							Union[str, Any]						=			[{'''col_1''': []}, {'''col_1''': [1, 2]}]
     UpperCAmelCase	:							Optional[int]						=			Dataset.from_list(__A						)
     self.assertEqual(dset.info.features['''col_1'''],		Sequence(Value('''int64'''						)						)						)





   def 	__magic_name__   (							self							:					Union[str, Any]						):
     UpperCAmelCase	:							str						=			Dataset.from_list([]						)
     self.assertEqual(len(__A						),		0						)
     self.assertListEqual(dset.column_names,		[]						)








from math import log

from scipy.constants import Boltzmann, physical_constants

_lowerCamelCase    :       Tuple        =							3_0_0  # TEMPERATURE (unit = K)

def       a__					(		UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			UpperCAmelCase							:      float    ,			)  ->						float:

  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()





