1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-22 20:00:29 +03:00

Removed useless check, added doc comments

This commit is contained in:
A_D 2021-05-07 14:27:32 +02:00
parent 985794fbcb
commit d3ffe6f0d9
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -836,14 +836,10 @@ class LinuxConfig(AbstractConfig):
self.filename.parent.mkdir(exist_ok=True, parents=True)
self.config: Optional[ConfigParser] = ConfigParser(comment_prefixes=('#',), interpolation=None)
self.config.read(self.filename) # read() ignores files that dont exist
try:
self.config.read(self.filename)
except Exception as e:
logger.debug(f'Error occurred while reading in file. Assuming that we are creating a new one: {e}')
self.config.add_section(self.SECTION)
# Ensure that our section exists
# Ensure that our section exists. This is here because configparser will happily create files for us, but it
# does not magically create sections
try:
self.config[self.SECTION].get("this_does_not_exist", fallback=None)
except KeyError: