-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from Zinkelburger/black_lint
Lint with black, remove unnecessary imports
- Loading branch information
Showing
15 changed files
with
458 additions
and
264 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,31 +1,52 @@ | ||
import os | ||
from logger import logger, configure_logger | ||
from logger import configure_logger | ||
import logging | ||
import argparse | ||
from pathlib import Path | ||
|
||
|
||
def parse_args() -> argparse.Namespace: | ||
|
||
parser = argparse.ArgumentParser(description='Build a custom image and store in the specified repository') | ||
parser.add_argument('config', metavar='config', type=str, help='Yaml file with test configuration (see config.yaml)') | ||
parser.add_argument('evaluator_config', metavar='evaluator_config', type=str, help="Yaml file with configuration for scoring test results (see eval-config.yaml)") | ||
parser.add_argument('-v', '--verbosity', choices=['debug', 'info', 'warning', 'error', 'critical'], default='info', help='Set the logging level (default: info)') | ||
parser = argparse.ArgumentParser( | ||
description="Build a custom image and store in the specified repository" | ||
) | ||
parser.add_argument( | ||
"config", | ||
metavar="config", | ||
type=str, | ||
help="Yaml file with test configuration (see config.yaml)", | ||
) | ||
parser.add_argument( | ||
"evaluator_config", | ||
metavar="evaluator_config", | ||
type=str, | ||
help="Yaml file with configuration for scoring test results (see eval-config.yaml)", | ||
) | ||
parser.add_argument( | ||
"-v", | ||
"--verbosity", | ||
choices=["debug", "info", "warning", "error", "critical"], | ||
default="info", | ||
help="Set the logging level (default: info)", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
log_levels = { | ||
'debug': logging.DEBUG, | ||
'info': logging.INFO, | ||
'warning': logging.WARNING, | ||
'error': logging.ERROR, | ||
'critical': logging.CRITICAL | ||
"debug": logging.DEBUG, | ||
"info": logging.INFO, | ||
"warning": logging.WARNING, | ||
"error": logging.ERROR, | ||
"critical": logging.CRITICAL, | ||
} | ||
args.verbosity = log_levels[args.verbosity] | ||
configure_logger(args.verbosity) | ||
|
||
if not Path(args.config).exists(): | ||
raise ValueError("Must provide a valid config.yaml file (see config.yaml)") | ||
if not Path(args.evaluator_config).exists(): | ||
raise ValueError("Must provide a valid config file to evaluate results (see eval-config.yaml)") | ||
raise ValueError( | ||
"Must provide a valid config file to evaluate results (see eval-config.yaml)" | ||
) | ||
|
||
return args |
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
Oops, something went wrong.