本文整理汇总了Python中brain.Brain.setup方法的典型用法代码示例。如果您正苦于以下问题:Python Brain.setup方法的具体用法?Python Brain.setup怎么用?Python Brain.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类brain.Brain
的用法示例。
在下文中一共展示了Brain.setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from brain import Brain [as 别名]
# 或者: from brain.Brain import setup [as 别名]
def setUp(self):
Brain.connection = sqlite3.connect(":memory:")
Brain.setup()
self.event = MagicMock(
id="223-unique-id",
title="Cool event",
enrollment_date=datetime.now(),
date=datetime.now(),
notification_sent=False,
)
示例2: Bro
# 需要导入模块: from brain import Brain [as 别名]
# 或者: from brain.Brain import setup [as 别名]
| | | |
| P R E S | | |
| | | |
| B R O | | |
| |__|_|
| |____)
|____________|
(______________)
''')
bro = Bro()
bro.feeds = [Online()]
bro.channels = [Facebook()]
# Setup memory if it does not exist
Brain.setup()
# Pull events from feeds every 30 minutes
def pull_events():
log.info('Pulling events from %d feed(s).' % len(bro.feeds))
bro.pull_events_from_feeds()
threading.Timer(60 * 30, pull_events).start()
# Push events to channel every 10 seconds
def push_events():
log.info('Pushing events to %d channel(s).' % len(bro.channels))
bro.push_events_to_channels()
threading.Timer(10.0, push_events).start()
# Kick off pull and push threads
pull_events()