Skip to content

Commit

Permalink
Use configparser methods
Browse files Browse the repository at this point in the history
Co-authored-by: CasperWA <CasperWA@github.com>
  • Loading branch information
ml-evs and CasperWA committed Feb 10, 2020
1 parent 87e5fdd commit 31ecf76
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions optimade/server/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def load_from_ini(self):

self.aliases = {}
for endpoint in {"links", "references", "structures"}:
if f"{endpoint}.aliases" in config.sections():
if f"{endpoint}.aliases" in config:
section = config[f"{endpoint}.aliases"]
self.aliases[endpoint] = tuple((key, section[key]) for key in section)
self.aliases[endpoint] = tuple(section.items())

self.provider_fields = {}
for endpoint in {"links", "references", "structures"}:
Expand Down Expand Up @@ -244,9 +244,7 @@ def load_from_json(self):
for endpoint in {"links", "references", "structures"}:
if endpoint in config["aliases"]:
section = config["aliases"][endpoint]
self.aliases[endpoint] = tuple(
(key, section[key]) for key in section
)
self.aliases[endpoint] = tuple(section.items())


CONFIG = ServerConfig()

0 comments on commit 31ecf76

Please sign in to comment.