# !/usr/bin/python # -*- encoding: utf-8 -*- """ @Time : 2025/07/10 14:40 @Author : @File : config.py @Software: VScode @Desc : None """ from configparser import ConfigParser class ConfigHandler: def __init__(self, config_file=""): self.config = ConfigParser() self.config.read(config_file, encoding='utf-8') def get(self, section, option, default=None): try: if section == "before": option = f"online_{option}" if bool(self.config.get("general", "is_online")) else f"inline_{option}" value = self.config.get(section, option) else: value = self.config.get(section, option) if "#" in value: value = value.split('#')[0].strip() except Exception as err: value = default return value def getboolean(self, section, option): return self.config.getboolean(section, option) config_handler = ConfigHandler("./config/config.ini")