mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-20 01:45:54 +00:00
Begin refactor arguments
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
BEST_ACCURACY_STREE = 40.282203
|
||||
ALL_METRICS = (
|
||||
@@ -132,33 +131,6 @@ class Symbols:
|
||||
better_best = black_star
|
||||
|
||||
|
||||
class EnvData:
|
||||
@staticmethod
|
||||
def load():
|
||||
args = {}
|
||||
with open(Files.dot_env) as f:
|
||||
for line in f.read().splitlines():
|
||||
if line == "" or line.startswith("#"):
|
||||
continue
|
||||
key, value = line.split("=")
|
||||
args[key] = value
|
||||
return args
|
||||
|
||||
|
||||
class EnvDefault(argparse.Action):
|
||||
# Thanks to https://stackoverflow.com/users/445507/russell-heilling
|
||||
def __init__(self, envvar, required=True, default=None, **kwargs):
|
||||
self._args = EnvData.load()
|
||||
default = self._args[envvar]
|
||||
required = False
|
||||
super(EnvDefault, self).__init__(
|
||||
default=default, required=required, **kwargs
|
||||
)
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
setattr(namespace, self.dest, values)
|
||||
|
||||
|
||||
class TextColor:
|
||||
BLUE = "\033[94m"
|
||||
CYAN = "\033[96m"
|
||||
|
||||
Reference in New Issue
Block a user