Config access is inconsistent across the codebase. Some files use try/except, others access directly.
Current patterns seen
- Direct access:
lifestream.config.get('section', 'key')
- Try/except with default:
try: val = config.get(...) except: val = None
- Has_option check:
if config.has_option('section', 'key'): ...
Proposed solution
Add helper functions to lifestream/__init__.py:
def get_config(section: str, key: str, default: str | None = None) -> str | None:
"""Get config value with optional default."""
if config.has_option(section, key):
return config.get(section, key)
return default
def get_config_bool(section: str, key: str, default: bool = False) -> bool:
"""Get boolean config value."""
if config.has_option(section, key):
return config.getboolean(section, key)
return default
Benefits
- Consistent error handling
- Cleaner code in import scripts
- Type-safe accessors
Config access is inconsistent across the codebase. Some files use try/except, others access directly.
Current patterns seen
lifestream.config.get('section', 'key')try: val = config.get(...) except: val = Noneif config.has_option('section', 'key'): ...Proposed solution
Add helper functions to
lifestream/__init__.py:Benefits