




"""simple docstring"""






from importlib import import_module

from .logging import get_logger


lowercase__  		=		get_logger(__name__)






class lowerCAmelCase__			:






			'''simple docstring'''



			def __init__(						self						,   lowercase						,   lowercase=None						):
							_lowerCamelCase  :    str					=					attrs or []
							if module is not None:
											for key in module.__dict__:
															if key in attrs or not key.startswith('__'						):
																			setattr(self						,   lowercase						,   getattr(lowercase						,   lowercase						)						)
							_lowerCamelCase  :    List[Any]					=					module._original_module if isinstance(lowercase						,   _PatchedModuleObj						) else module






class lowerCAmelCase__			:






			'''simple docstring'''



			lowerCamelCase__   =    []
			def __init__(						self						,   lowercase						,   lowercase						,   lowercase						,   lowercase=None						):
							_lowerCamelCase  :    Any					=					obj
							_lowerCamelCase  :    List[str]					=					target
							_lowerCamelCase  :    str					=					new
							_lowerCamelCase  :    Optional[Any]					=					target.split('.'						)[0]
							_lowerCamelCase  :    Optional[Any]					=					{}
							_lowerCamelCase  :    Union[str, Any]					=					attrs or []
			def __enter__(						self						):
							*_lowerCamelCase,				_lowerCamelCase  :    List[Any]					=					self.target.split('.'						)

							# Patch modules:
							# it's used to patch attributes of submodules like "os.path.join";
							# in this case we need to patch "os" and "os.path"

							for i in range(len(lowercase						)						):
											try:
															_lowerCamelCase  :    int					=					import_module('.'.join(submodules[: i + 1]						)						)
											except ModuleNotFoundError:
															continue
											# We iterate over all the globals in self.obj in case we find "os" or "os.path"
											for attr in self.obj.__dir__():
															_lowerCamelCase  :    Optional[Any]					=					getattr(self.obj						,   lowercase						)
															# We don't check for the name of the global, but rather if its value *is* "os" or "os.path".
															# This allows to patch renamed modules like "from os import path as ospath".
															if obj_attr is submodule or (
															    (isinstance(lowercase						,   _PatchedModuleObj						) and obj_attr._original_module is submodule)
															):
																			_lowerCamelCase  :    Any					=					obj_attr
																			# patch at top level
																			setattr(self.obj						,   lowercase						,   _PatchedModuleObj(lowercase						,   attrs=self.attrs						)						)
																			_lowerCamelCase  :    List[Any]					=					getattr(self.obj						,   lowercase						)
																			# construct lower levels patches
																			for key in submodules[i + 1 :]:
																							setattr(lowercase						,   lowercase						,   _PatchedModuleObj(getattr(lowercase						,   lowercase						,   lowercase						)						,   attrs=self.attrs						)						)
																							_lowerCamelCase  :    int					=					getattr(lowercase						,   lowercase						)
																			# finally set the target attribute
																			setattr(lowercase						,   lowercase						,   self.new						)

        # Patch attribute itself:
        # it's used for builtins like "open",
        # and also to patch "os.path.join" we may also need to patch "join"
        # itself if it was imported as "from os.path import join".

							if submodules:  # if it's an attribute of a submodule like "os.path.join"
											try:
															_lowerCamelCase  :    Optional[int]					=					getattr(import_module('.'.join(lowercase						)						)						,   lowercase						)
											except (AttributeError, ModuleNotFoundError):
															return
											# We iterate over all the globals in self.obj in case we find "os.path.join"
											for attr in self.obj.__dir__():
															# We don't check for the name of the global, but rather if its value *is* "os.path.join".
															# This allows to patch renamed attributes like "from os.path import join as pjoin".
															if getattr(self.obj						,   lowercase						) is attr_value:
																			_lowerCamelCase  :    str					=					getattr(self.obj						,   lowercase						)
																			setattr(self.obj						,   lowercase						,   self.new						)
							elif target_attr in globals()["__builtins__"]:  # if it'a s builtin like "open"
											_lowerCamelCase  :    Union[str, Any]					=					globals()['__builtins__'][target_attr]
											setattr(self.obj						,   lowercase						,   self.new						)
							else:
											raise RuntimeError(F'''Tried to patch attribute {target_attr} instead of a submodule.'''						)
			def __exit__(						self						,   *lowercase						):
							for attr in list(self.original						):
											setattr(self.obj						,   lowercase						,   self.original.pop(lowercase						)						)
			def       A_					(						self						):
							self.__enter__()
							self._active_patches.append(self						)






			def       A_					(						self						):
							try:
											self._active_patches.remove(self						)
							except ValueError:
											# If the patch hasn't been started this will fail
											return None

							return self.__exit__()





"""simple docstring"""






from math import pow, sqrt







def   _snake_case    (       *lowercase__	):
				_lowerCamelCase  :    Dict					=					len(lowercase__	) > 0 and all(value > 0.0 for value in values	)
				return result







def   _snake_case    (       lowercase__							,					lowercase__	):
				return (
				    round(sqrt(molar_mass_a / molar_mass_a	)							,					6	)
				    if validate(lowercase__							,					lowercase__	)
				    else ValueError('Input Error: Molar mass values must greater than 0.'	)
				)







def   _snake_case    (       lowercase__							,					lowercase__							,					lowercase__	):
				return (
				    round(effusion_rate * sqrt(molar_mass_a / molar_mass_a	)							,					6	)
				    if validate(lowercase__							,					lowercase__							,					lowercase__	)
				    else ValueError(
				        'Input Error: Molar mass and effusion rate values must greater than 0.'	)
				)







def   _snake_case    (       lowercase__							,					lowercase__							,					lowercase__	):
				return (
				    round(effusion_rate / sqrt(molar_mass_a / molar_mass_a	)							,					6	)
				    if validate(lowercase__							,					lowercase__							,					lowercase__	)
				    else ValueError(
				        'Input Error: Molar mass and effusion rate values must greater than 0.'	)
				)







def   _snake_case    (       lowercase__							,					lowercase__							,					lowercase__	):
				return (
				    round(molar_mass / pow(effusion_rate_a / effusion_rate_a							,					2	)							,					6	)
				    if validate(lowercase__							,					lowercase__							,					lowercase__	)
				    else ValueError(
				        'Input Error: Molar mass and effusion rate values must greater than 0.'	)
				)







def   _snake_case    (       lowercase__							,					lowercase__							,					lowercase__	):
				return (
				    round(pow(effusion_rate_a / effusion_rate_a							,					2	) / molar_mass							,					6	)
				    if validate(lowercase__							,					lowercase__							,					lowercase__	)
				    else ValueError(
				        'Input Error: Molar mass and effusion rate values must greater than 0.'	)
				)