globals.py 592 B

123456789101112131415161718192021222324
  1. class Globals(object):
  2. """
  3. Object to make it easy to work with global values
  4. """
  5. def __init__(self):
  6. self._globals = dict()
  7. def get_global(self, item):
  8. """
  9. Get a global value
  10. :param item: the item to get
  11. :return: the value of the global value of item
  12. """
  13. return self._globals.get(item, None)
  14. def set_global(self, key, value):
  15. """
  16. Set a global value
  17. :param key: the key to set
  18. :param value: the value to set it to
  19. """
  20. self._globals[key] = value
  21. glob = Globals()