本文整理汇总了Python中neubot.config.CONFIG.merge_properties方法的典型用法代码示例。如果您正苦于以下问题:Python CONFIG.merge_properties方法的具体用法?Python CONFIG.merge_properties怎么用?Python CONFIG.merge_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neubot.config.CONFIG
的用法示例。
在下文中一共展示了CONFIG.merge_properties方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from neubot.config import CONFIG [as 别名]
# 或者: from neubot.config.CONFIG import merge_properties [as 别名]
def main(args):
''' Main function '''
try:
options, arguments = getopt.getopt(args[1:], 'D:t:v')
except getopt.error:
sys.exit('usage: notifier_browser [-v] [-D setting] [-t time] page...')
if not arguments:
sys.exit('usage: notifier_browser [-v] [-D setting] [-t time] page...')
sleeptime = 0
for name, value in options:
if name == '-D':
CONFIG.register_property(value)
elif name == '-t':
sleeptime = int(value)
elif name == '-v':
CONFIG['verbose'] = 1
CONFIG.merge_properties()
for argument in arguments:
if argument == 'privacy':
NOTIFIER_BROWSER.notify_bad_privacy()
elif argument == 'update':
NOTIFIER_BROWSER.notify_update_avail()
else:
sys.exit('Invalid page. Valid pages are: privacy, update')
if sleeptime:
logging.debug('notifier_browser: sleep for %d seconds', sleeptime)
time.sleep(sleeptime)
示例2: main
# 需要导入模块: from neubot.config import CONFIG [as 别名]
# 或者: from neubot.config.CONFIG import merge_properties [as 别名]
def main(name, descr, args):
Eflag = False
lflag = False
try:
options, arguments = getopt.getopt(args[1:], "D:Ef:lVv", ["help"])
except getopt.GetoptError:
write_help(sys.stderr, name, descr)
sys.exit(1)
if arguments:
write_help(sys.stderr, name, descr)
sys.exit(1)
verbose = 0
for key, value in options:
if key == "-D":
# No shortcuts because it grows too confusing
CONFIG.register_property(value)
elif key == "-E":
Eflag = True
elif key == "-f":
DATABASE.set_path(value)
elif key == "--help":
write_help(sys.stdout, name, descr)
sys.exit(0)
elif key == "-l":
lflag = True
elif key == "-V":
sys.stdout.write(VERSION + "\n")
sys.exit(0)
elif key == "-v":
verbose = 1
DATABASE.connect()
CONFIG.merge_database(DATABASE.connection())
if not Eflag:
CONFIG.merge_environ()
CONFIG.merge_properties()
# Apply the setting after we've read database and environment
if verbose:
CONFIG['verbose'] = 1
if lflag:
CONFIG.print_descriptions(sys.stdout)
sys.exit(0)