# utils.variable_util.py
class Varaible:
"""
globale varaible class. you can set a global variables for your project. and then other module can use the variables
"""
def set_variable(self, name, value) -> None:
"""
set variables
:param name: variable name
:param value: variable value
:return: None
"""
try:
self.__setattr__(name, value)
return (name, self.get(name))
except AttributeError:
return None
def get_variable(self, name):
"""
get the variable you set, if not the variable will return None
:param name: variable name
:return: variable value or None
"""
try:
return self.__getattribute__(name)
except AttributeError:
return None
def del_variable(self, name):
"""
delete your variable. if delete success will retrun True, else retrun None
:param name: variable name
:return: True or False
"""
try:
self.__delattr__(name)
return True
except AttributeError:
return None