config.py 626 B

12345678910111213141516171819202122232425
  1. # -*- coding: utf-8 -*-
  2. # @Time : 2022/2/25 13:53
  3. # @Author : MaochengHu
  4. # @Email : wojiaohumaocheng@gmail.com
  5. # @File : config.py
  6. # @Project : server_develop
  7. class Config(object):
  8. def __init__(self, config_dict: dict):
  9. for key, val in config_dict.items():
  10. self.__setattr__(key, val)
  11. def copy(self, new_config_dict: dict):
  12. """
  13. Copies this config into a new config object, making
  14. the changes given by new_config_dict.
  15. """
  16. ret = Config(vars(self))
  17. for key, val in new_config_dict.items():
  18. ret.__setattr__(key, val)
  19. return ret