當前位置: 首頁>>代碼示例>>Python>>正文


Python utils.get_config方法代碼示例

本文整理匯總了Python中utils.get_config方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.get_config方法的具體用法?Python utils.get_config怎麽用?Python utils.get_config使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在utils的用法示例。


在下文中一共展示了utils.get_config方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: eval_config

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
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) 
開發者ID:asanakoy,項目名稱:kaggle_carvana_segmentation,代碼行數:22,代碼來源:carvana_eval.py

示例2: train_config

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
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) 
開發者ID:asanakoy,項目名稱:kaggle_carvana_segmentation,代碼行數:19,代碼來源:train.py

示例3: __init__

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
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)) 
開發者ID:freedomofpress,項目名稱:fingerprint-securedrop,代碼行數:14,代碼來源:database.py

示例4: test_read_config

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
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}") 
開發者ID:freedomofpress,項目名稱:fingerprint-securedrop,代碼行數:10,代碼來源:test_utils.py

示例5: test_coalesce_ordered_dict

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
def test_coalesce_ordered_dict(self):
        config = get_config()
        class_tests = coalesce_ordered_dict(config['sorter']['class_tests'])
        self.assertIsInstance(class_tests, OrderedDict) 
開發者ID:freedomofpress,項目名稱:fingerprint-securedrop,代碼行數:6,代碼來源:test_utils.py

示例6: main

# 需要導入模塊: import utils [as 別名]
# 或者: from utils import get_config [as 別名]
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() 
開發者ID:marqsm,項目名稱:LED-bot,代碼行數:50,代碼來源:bot_scheduler.py


注:本文中的utils.get_config方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。