Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bot: use optionxform()-ed setting names for existence check #2193

Merged
merged 1 commit into from
Oct 11, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from ast import literal_eval
from datetime import datetime
import inspect
import itertools
import logging
import re
Expand Down Expand Up @@ -352,8 +353,13 @@ def post_setup(self):
"""
settings = self.settings
for section_name, section in settings.get_defined_sections():
defined_options = {
settings.parser.optionxform(opt)
for opt, _ in inspect.getmembers(section)
if not opt.startswith('_')
}
for option_name in settings.parser.options(section_name):
if not hasattr(section, option_name):
if option_name not in defined_options:
LOGGER.warning(
"Config option `%s.%s` is not defined by its section "
"and may not be recognized by Sopel.",
Expand Down