Python utils.get_config() Examples
The following are 6
code examples of utils.get_config().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
utils
, or try the search function
.
Example #1
Source File: carvana_eval.py From kaggle_carvana_segmentation with MIT License | 6 votes |
def eval_config(config_path): test = True config = get_config(config_path) num_workers = 0 if os.name == 'nt' else 3 root = config.dataset_path image_folder_name = 'train_hq' if not test else 'test_hq' c_ds = CarvanaDataset(root, config.img_rows, config.img_cols, image_folder_name=image_folder_name, apply_clahe=config.use_clahe) ds = H5LikeFileInterface(c_ds) if not test: f = 'f04a.csv' if 'f04a' in config.folder else 'fma.csv' folds = get_csv_folds(os.path.join('..', f), os.listdir(os.path.join(root, image_folder_name))) else: folds = [([], list(range(len(c_ds)))) for i in range(5)] keval = CarvanaEval(config, ds, folds, test=test, flips=flip.FLIP_LR, num_workers=num_workers, border=0) keval.need_dice = True skip_folds = [i for i in range(5) if config.fold is not None and i != int(config.fold)] print('skipping folds: ', skip_folds) keval.predict(skip_folds=skip_folds)
Example #2
Source File: train.py From kaggle_carvana_segmentation with MIT License | 6 votes |
def train_config(config_path): config = get_config(config_path) root = config.dataset_path image_folder_name = 'train_hq' ds = H5LikeFileInterface(CarvanaDataset(root, config.img_rows, config.img_cols, image_folder_name=image_folder_name, apply_clahe=config.use_clahe)) f = 'f04a.csv' if 'f04a' in config.folder else 'fma.csv' folds = get_csv_folds(os.path.join('..', f), os.listdir(os.path.join(root, image_folder_name))) num_workers = 0 if os.name == 'nt' else 5 skip_folds = [i for i in range(5) if config.fold is not None and i != int(config.fold)] print('skipping folds: ', skip_folds) train(ds, folds, config, num_workers=num_workers, transforms=augment_color, skip_folds=skip_folds)
Example #3
Source File: database.py From fingerprint-securedrop with GNU Affero General Public License v3.0 | 5 votes |
def __init__(self, database_config=None): if not database_config: database_config = get_config()['database'] try: self.engine = create_engine( 'postgresql://{pguser}:@{pghost}:{pgport}/{pgdatabase}'.format( **database_config)) except OperationalError as exc: panic("fingerprint-securedrop Postgres support relies on use of a " "PGPASSFILE. Make sure this file exists in your homedir with " "0600 permissions:\n{}.".format(exc))
Example #4
Source File: test_utils.py From fingerprint-securedrop with GNU Affero General Public License v3.0 | 5 votes |
def test_read_config(self): config = get_config() self.assertTrue(config.has_section('sorter')) self.assertTrue(config.has_section('crawler')) self.assertIsInstance(config.getint('sorter', 'page_load_timeout'), int) entry_nodes = config['crawler']['entry_nodes'].split(',') self.assertRegex(entry_nodes[0], "[0-9A-F]{40}")
Example #5
Source File: test_utils.py From fingerprint-securedrop with GNU Affero General Public License v3.0 | 5 votes |
def test_coalesce_ordered_dict(self): config = get_config() class_tests = coalesce_ordered_dict(config['sorter']['class_tests']) self.assertIsInstance(class_tests, OrderedDict)
Example #6
Source File: bot_scheduler.py From LED-bot with MIT License | 4 votes |
def main(): """ Main entry point. Used in the console script we setup. Comment out any handlers you do not wish to use """ from zulipRequestHandler import ZulipRequestHandler from webFillerHandler import WebFillerHandler from webRequestHandler import WebRequestHandler from ircRequestHandler import IRCBot from mqttHandler import mqttHandler from slackRequestHandler import slackRequestHandler from utils import get_config config = get_config() ZULIP_USERNAME = config.get('zulip', 'username') ZULIP_API_KEY = config.get('zulip', 'api_key') HTTP_SERVER_HOST = config.get('http', 'host') HTTP_SERVER_PORT = config.get('http', 'port') LED_SCREEN_ADDRESS = config.get('main', 'led_screen_address') FILLER_TIME_INTERVAL = config.get('fillers','time_interval') IRC_SERVER = config.get('irc','host') IRC_CHANNEL = config.get('irc','channel') IRC_NICK = config.get('irc','nick') # zulipRequestHandler = ZulipRequestHandler(ZULIP_USERNAME, ZULIP_API_KEY) webRequestHandler = WebRequestHandler(HTTP_SERVER_HOST,HTTP_SERVER_PORT) # mqttHandler = mqttHandler() # ircBot = IRCBot(IRC_CHANNEL,IRC_NICK,IRC_SERVER,port=6667) # webFillerHandler = WebFillerHandler(FILLER_TIME_INTERVAL) slackRequestHandler = slackRequestHandler("") led_bot = LEDBot( address=LED_SCREEN_ADDRESS, listeners=[webRequestHandler,slackRequestHandler] ) ## Uncomment the lines below to be able to test the bot from the CLI. # from cli_handler import CLIHandler # led_bot = LEDBot( # address=LED_SCREEN_ADDRESS, # listeners=[CLIHandler(), zulipRequestHandler] # ) led_bot.run()