Skip to content

Commit

Permalink
Fix lookup of configuration options
Browse files Browse the repository at this point in the history
When the type of an embedder was not specified in the config, it was added
automatically during embedder initialization. This prevented correct default
option lookup (because it ends as soon as a "type" field is found).
  • Loading branch information
rgemulla committed Aug 7, 2019
1 parent 97c6577 commit d90358d
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions kge/model/kge_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,18 +155,12 @@ def __init__(self, config: Config, dataset: Dataset, configuration_key: str):
#: location of the configuration options of this embedder
self.configuration_key = configuration_key
self.embedder_type = self.get_option("type")
if self.configuration_key + ".type" not in config.options:
self.config.set(
self.configuration_key + ".type",
self.embedder_type,
create=True,
log=True,
)

# verify all custom options by trying to set them in a copy of this
# configuration (quick and dirty, but works)
custom_options = Config.flatten(config.get(self.configuration_key))
del custom_options["type"]
if "type" in custom_options:
del custom_options["type"]
dummy_config = self.config.clone()
for key, value in custom_options.items():
try:
Expand Down

0 comments on commit d90358d

Please sign in to comment.