当前位置: 首页>>代码示例>>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;未经允许,请勿转载。