Skip to content

Instantly share code, notes, and snippets.

View cluelessperson's full-sized avatar

Clueless cluelessperson

View GitHub Profile
import logging, pathlib, json, sys, subprocess, os
from .. import version
from .logging import root_logger as logger
class Config(object):
def __init__(self):
self.config = {"log_level": "INFO"}
def __getattr__(self, attr):
from .util.logging import root_logger as logger
from .util.config import FileConfig, GCloudFileConfig, EnvironmentalVariableConfig, CliConfig, ConfigCombiner
config = ConfigCombiner(
[
FileConfig,
GCloudFileConfig,
EnvironmentalVariableConfig,
CliConfig
],
import logging, pathlib, json, sys, subprocess, os
from .. import version
from .logging import root_logger as logger
class Config(object):
def __init__(self, parent_logger=logger):
self.log = parent_logger.getChild(self.__class__.__name__)
self.config = {"log_level": "INFO"}
import sys, subprocess, os, pathlib, json
import fbf
def _get_cli_config_file():
if ".json" in sys.argv[-1]:
return sys.argv[-1]
def _get_cli_config():
import logging, pathlib, json, sys, subprocess, os
from .logging import root_logger as logger
class Config(object):
def __init__(self, parent_logger:logging.Logger=logger):
self.log = parent_logger.getChild(self.__class__.__name__)
self.config = {"log_level": "INFO"}
def __getattr__(self, attr):
class Config(object):
def __init__(self, parent_logger:logging.Logger=logger):
self.log = parent_logger.getChild(self.__class__.__name__)
self.config = {}
print("here")
def __getattr__(self, attr):
try:
return self.config[attr]
except IndexError:
@staticmethod
def _get_cli_config():
for i, arg in enumerate(sys.argv):
if "--" in arg and len(sys.argv)-1 > i:
key = arg[2:]
value = sys.argv[i+1]
yield (key, value)