
"""simple docstring"""





from collections import deque

from .hash_table import HashTable



class __lowerCAmelCase					(       _lowercase   ):




			"""simple docstring"""







			def __init__(					self    :       int							, *_snake_case    :       List[str]							, **_snake_case    :       Optional[Any]						)   ->			Optional[int]:







								"""simple docstring"""
								super().__init__(*__UpperCamelCase							, **__UpperCamelCase						)




			def   lowerCamelCase__  (					self    :       Optional[int]							, _snake_case    :       List[str]							, _snake_case    :       str						)   ->			Dict:







								"""simple docstring"""
								A_								=    deque([]						) if self.values[key] is None else self.values[key]
								self.values[key].appendleft(__UpperCamelCase						)
								A_								=    self.values[key]




			def   lowerCamelCase__  (					self    :       Tuple						)   ->			Tuple:







								"""simple docstring"""
								return (
								    sum(self.charge_factor - len(__UpperCamelCase						) for slot in self.values						)
								    / self.size_table
								    * self.charge_factor
								)






			def   lowerCamelCase__  (					self    :       Dict							, _snake_case    :       Union[str, Any]							, _snake_case    :       Union[str, Any]=None						)   ->			Any:







								"""simple docstring"""
								if not (
								    len(self.values[key]						) == self.charge_factor and self.values.count(__UpperCamelCase						) == 0
								):
													return key
								return super()._collision_resolution(__UpperCamelCase							, __UpperCamelCase						)






def   __lowerCAmelCase    (				UpperCAmelCase__					:   int							)	->     int:

							if not isinstance(UpperCAmelCase__      ,					UpperCAmelCase__							):
														raise ValueError("""multiplicative_persistence() only accepts integral values"""							)
							if num < 0:
														raise ValueError("""multiplicative_persistence() does not accept negative values"""							)

							lowerCamelCase_					=       0
							lowerCamelCase_					=       str(UpperCAmelCase__							)

							while len(UpperCAmelCase__							) != 1:
														lowerCamelCase_					=       [int(UpperCAmelCase__							) for i in num_string]

														lowerCamelCase_					=       1
														for i in range(0      ,					len(UpperCAmelCase__							)							):
																					total *= numbers[i]

														lowerCamelCase_					=       str(UpperCAmelCase__							)

														steps += 1
							return steps



def   __lowerCAmelCase    (				UpperCAmelCase__					:   int							)	->     int:

							if not isinstance(UpperCAmelCase__      ,					UpperCAmelCase__							):
														raise ValueError("""additive_persistence() only accepts integral values"""							)
							if num < 0:
														raise ValueError("""additive_persistence() does not accept negative values"""							)

							lowerCamelCase_					=       0
							lowerCamelCase_					=       str(UpperCAmelCase__							)

							while len(UpperCAmelCase__							) != 1:
														lowerCamelCase_					=       [int(UpperCAmelCase__							) for i in num_string]

														lowerCamelCase_					=       0
														for i in range(0      ,					len(UpperCAmelCase__							)							):
																					total += numbers[i]

														lowerCamelCase_					=       str(UpperCAmelCase__							)

														steps += 1
							return steps


if __name__ == "__main__":
		import doctest

		doctest.testmod()





