Skip to content

Commit

Permalink
Separated reading qleverfile by ConfigParser logic for use in other_e…
Browse files Browse the repository at this point in the history
…ngines.config
  • Loading branch information
tanmay-9 committed Feb 3, 2025
1 parent fcdaebb commit 8f2519c
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/qlever/qleverfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,10 @@ def arg(*args, **kwargs):
return all_args

@staticmethod
def read(qleverfile_path):
def read_qleverfile(qleverfile_path):
"""
Read the given Qleverfile (the function assumes that it exists) and
return a `ConfigParser` object with all the options and their values.
NOTE: The keys have the same hierarchical structure as the keys in
`all_arguments()`. The Qleverfile may contain options that are not
defined in `all_arguments()`. They can be used as temporary variables
to define other options, but cannot be accessed by the commands later.
Read the Qleverfile using ConfigParser and return cleaned config
"""

# Read the Qleverfile.
defaults = {"random": "83724324hztz", "version": "01.01.01"}
config = ConfigParser(
Expand Down Expand Up @@ -368,6 +361,22 @@ def read(qleverfile_path):
exit(1)
config[section][option] = value

return config

@staticmethod
def read(qleverfile_path):
"""
Read the given Qleverfile (the function assumes that it exists) and
return a `ConfigParser` object with all the options and their values.
NOTE: The keys have the same hierarchical structure as the keys in
`all_arguments()`. The Qleverfile may contain options that are not
defined in `all_arguments()`. They can be used as temporary variables
to define other options, but cannot be accessed by the commands later.
"""

config = Qleverfile.read_qleverfile(qleverfile_path)

# Make sure that all the sections are there.
for section in ["data", "index", "server", "runtime", "ui"]:
if section not in config:
Expand Down

0 comments on commit 8f2519c

Please sign in to comment.