Restore the ability to use inline comments in config files
The ability was lost in the switch to Python 3, because the config parser module in the standard library changed its defaults. [Python 2][2]: > Comments may appear on their own in an otherwise empty line, or > may be entered in lines holding values or section names. [Python 3][3]: > Inline comments can be harmful because they prevent users > from using the delimiting characters as parts of values. > That being said, this can be customized. [2]: https://docs.python.org/2/library/configparser.html#module-ConfigParser [3]: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure Signed-off-by: Neil Mayhew <neil@neil.mayhew.name>
This commit is contained in:
@@ -36,7 +36,8 @@ class Config:
|
||||
def __init__(self, path=None):
|
||||
self._path = path or directory.config_path()
|
||||
|
||||
self._parser = configparser.ConfigParser()
|
||||
self._parser = configparser.ConfigParser(
|
||||
inline_comment_prefixes=(';'))
|
||||
|
||||
self.open()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user