本文整理汇总了Python中neubot.config.CONFIG.register_defaults_helper方法的典型用法代码示例。如果您正苦于以下问题:Python CONFIG.register_defaults_helper方法的具体用法?Python CONFIG.register_defaults_helper怎么用?Python CONFIG.register_defaults_helper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.config.CONFIG
的用法示例。
在下文中一共展示了CONFIG.register_defaults_helper方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to
# 需要导入模块: from neubot.config import CONFIG [as 别名]
# 或者: from neubot.config.CONFIG import register_defaults_helper [as 别名]
('bittorrent.address', '', 'Address to listen/connect to ("" = auto)'),
('bittorrent.bytes.down', 0, 'Num of bytes to download (0 = auto)'),
('bittorrent.bytes.up', 0, 'Num of bytes to upload (0 = auto)'),
('bittorrent.daemonize', False, 'Become a daemon and run in background'),
('bittorrent.infohash', '', 'Set InfoHash ("" = auto)'),
('bittorrent.listen', False, 'Run in server mode'),
('bittorrent.negotiate', True, 'Enable negotiate client/server'),
('bittorrent.negotiate.port', 80, 'Negotiate port'),
('bittorrent.my_id', '', 'Set local PeerId ("" = auto)'),
('bittorrent.numpieces', NUMPIECES, 'Num of pieces in bitfield'),
('bittorrent.piece_len', PIECE_LEN, 'Length of each piece'),
('bittorrent.port', 6881, 'Port to listen/connect to (0 = auto)'),
('bittorrent.watchdog', WATCHDOG, 'Maximum test run-time in seconds'),
)
CONFIG.register_defaults_helper(PROPERTIES)
def register_descriptions():
''' Registers the description of bittorrent variables '''
CONFIG.register_descriptions_helper(PROPERTIES)
def _random_bytes(num):
''' Generates a random string of @num bytes '''
return ''.join([chr(random.randint(32, 126)) for _ in range(num)])
def finalize_conf(conf):
''' Finalize configuration and guess the proper value of all
the undefined variables '''
if not conf['bittorrent.my_id']: