From 94418bebeed3cd3185dc3a513c23fa40cb8a2492 Mon Sep 17 00:00:00 2001 From: agessaman Date: Sun, 22 Feb 2026 20:43:43 -0800 Subject: [PATCH] Refactor configuration handling in MeshCoreBot - Removed custom _DuplicateAwareConfigParser in favor of standard configparser.ConfigParser. - Simplified configuration loading process while maintaining existing functionality. --- modules/core.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/modules/core.py b/modules/core.py index 20f25c7..626e0c5 100644 --- a/modules/core.py +++ b/modules/core.py @@ -43,22 +43,6 @@ from .transmission_tracker import TransmissionTracker from .utils import resolve_path -class _DuplicateAwareConfigParser(configparser.ConfigParser): - """ConfigParser that allows duplicate options (last value wins) and logs ERROR when seen.""" - - def __init__(self, *args, **kwargs): - kwargs['strict'] = False - super().__init__(*args, **kwargs) - - def _handle_option(self, st, line, fpname): - if st.optname in st.options: - logging.getLogger(__name__).error( - "Duplicate option in config file: section [%s], option '%s' (file %s, line %s). Using last value.", - st.sectname, st.optname, fpname, getattr(st, 'lineno', '?'), - ) - st.options[st.optname] = st.optvalue - - class MeshCoreBot: """MeshCore Bot using official meshcore package. @@ -68,7 +52,7 @@ class MeshCoreBot: def __init__(self, config_file: str = "config.ini"): self.config_file = config_file - self.config = _DuplicateAwareConfigParser() + self.config = configparser.ConfigParser() self.load_config() # Setup logging