-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First working version of the config parser
This was the hard part. In particular, autocompletion works now in a pretty generic way. And the help info shows which arguments have values in the Qleverfile. TODO: Right now, the help info is still Python-style. At some point, we should format this in a way that is more consistent with the output of the rest of the script.
- Loading branch information
Hannah Bast
committed
Feb 25, 2024
1 parent
3376071
commit a9e0c66
Showing
8 changed files
with
251 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
__pycache__ | ||
build/ | ||
dist/ | ||
*.egg-info | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2024, University of Freiburg, | ||
# Chair of Algorithms and Data Structures | ||
# Author: Hannah Bast <[email protected]> | ||
|
||
import logging | ||
from termcolor import colored | ||
|
||
|
||
class CustomFormatter(logging.Formatter): | ||
""" | ||
Custom formatter for logging. | ||
""" | ||
def format(self, record): | ||
message = record.getMessage() | ||
if record.levelno == logging.DEBUG: | ||
return colored(f"DEBUG: {message}", "magenta") | ||
elif record.levelno == logging.WARNING: | ||
return colored(f"WARNING: {message}", "yellow") | ||
elif record.levelno in [logging.CRITICAL, logging.ERROR]: | ||
return colored(f"ERROR: {message}", "red") | ||
else: | ||
return message | ||
|
||
|
||
# Custom logger. | ||
log = logging.getLogger("qlever") | ||
log.setLevel(logging.INFO) | ||
handler = logging.StreamHandler() | ||
handler.setFormatter(CustomFormatter()) | ||
log.addHandler(handler) |
Oops, something went wrong.