storage.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #
  2. # Класс хранилище данных
  3. #
  4. class storage:
  5. __data = {}
  6. def __new__(cls):
  7. if not hasattr(cls, 'instance'):
  8. cls.instance = super(storage, cls).__new__(cls)
  9. return cls.instance
  10. @property
  11. def data(self) -> dict:
  12. """
  13. Данные по моделям
  14. Returns:
  15. _type_: _description_
  16. """
  17. return self.__data
  18. @staticmethod
  19. def nomenclature_key():
  20. """
  21. Ключ для хранения номенклатуры
  22. Returns:
  23. _type_: _description_
  24. """
  25. return "nomenclature"
  26. @staticmethod
  27. def nomenclature_group_key():
  28. """
  29. Списк номенклатурных групп
  30. Returns:
  31. _type_: _description_
  32. """
  33. return "group"
  34. @staticmethod
  35. def measurement_unit_key():
  36. """
  37. Список единиц измерения
  38. Returns:
  39. _type_: _description_
  40. """
  41. return "unit"
  42. @staticmethod
  43. def recipe_key():
  44. """
  45. Список рецептов
  46. Returns:
  47. _type_: _description_
  48. """
  49. return "recipe"