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
@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) |
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
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: |
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
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): |
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
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(): |
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
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"} |
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
from .util.logging import root_logger as logger | |
from .util.config import FileConfig, GCloudFileConfig, EnvironmentalVariableConfig, CliConfig, ConfigCombiner | |
config = ConfigCombiner( | |
[ | |
FileConfig, | |
GCloudFileConfig, | |
EnvironmentalVariableConfig, | |
CliConfig | |
], |
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
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): |
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
def coerce_number(s, zero_if_fail=False): | |
s = s.strip() | |
try: | |
return int(s) | |
except ValueError: | |
try: | |
return float(s) | |
except ValueError: | |
if zero_if_fail: | |
return 0 |
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
"board": [ | |
{ | |
"lvl1": 1 if 0 <= i <= 7 else 0, | |
"lvl2": 1 if 8 <= i <= 15 else 0, | |
"lvl3": 1 if 16 <= i <= 23 else 0, | |
"lvl4": 1 if 24 <= i <= 31 else 0 | |
} | |
for i in range(32) | |
] |
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
default_state = { | |
"turn": 1, | |
"player_count": 1, | |
"players": [ | |
{ | |
"score": 0, | |
"depth": 0, | |
"turned_back": False, | |
"haul": { | |
"stacks": 0, |
OlderNewer