本文整理汇总了Python中supybot.ircmsgs.ping函数的典型用法代码示例。如果您正苦于以下问题:Python ping函数的具体用法?Python ping怎么用?Python ping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ping函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testHashing
def testHashing(self):
msg = ircmsgs.ping('0')
irc = irclib.Irc('test')
proxy = callbacks.SimpleProxy(irc, msg)
# First one way...
self.failIf(proxy != irc)
self.failUnless(proxy == irc)
self.assertEqual(hash(proxy), hash(irc))
# Then the other!
self.failIf(irc != proxy)
self.failUnless(irc == proxy)
self.assertEqual(hash(irc), hash(proxy))
# And now dictionaries...
d = {}
d[irc] = 'foo'
self.failUnless(len(d) == 1)
self.failUnless(d[irc] == 'foo')
self.failUnless(d[proxy] == 'foo')
d[proxy] = 'bar'
self.failUnless(len(d) == 1)
self.failUnless(d[irc] == 'bar')
self.failUnless(d[proxy] == 'bar')
d[irc] = 'foo'
self.failUnless(len(d) == 1)
self.failUnless(d[irc] == 'foo')
self.failUnless(d[proxy] == 'foo')
示例2: _addIrc
def _addIrc(self, irc):
# Let's just be extra-special-careful here.
if irc not in self.ircstates:
self.ircstates[irc] = irclib.IrcState()
if irc not in self.lastmsg:
self.lastmsg[irc] = ircmsgs.ping('this is just a fake message')
if not world.testing:
for channel in irc.state.channels:
irc.queueMsg(ircmsgs.who(channel))
irc.queueMsg(ircmsgs.names(channel))
示例3: latency
def latency(self, irc, msg, args, otherIrc):
"""[<network>]
Returns the current latency to <network>. <network> is only necessary
if the message isn't sent on the network to which this command is to
apply.
"""
otherIrc.queueMsg(ircmsgs.ping(_("Latency check (from %s).") % msg.nick))
self._latency[otherIrc] = (irc, time.time())
irc.noReply()
示例4: pin
def pin(self, irc, msg, args, name):
"""<name>
PINGS <name> and return reply"""
v = irc.queueMsg(ircmsgs.ping(name))
irc.reply(v)
m = conf.supybot.directories.plugins
irc.reply(m)
k = sys.modules[name]
irc.reply(k)
示例5: __call__
def __call__(self, irc, msg):
if irc not in self.ircstates:
self.ircstates[irc] = irclib.IrcState()
try:
self.ircstates[irc].addMsg(irc, self.lastmsg[irc])
except KeyError:
self.ircstates[irc].addMsg(irc,
ircmsgs.ping("placeholder message"))
finally:
self.lastmsg[irc] = msg
self.__parent.__call__(irc, msg)
示例6: _addIrc
def _addIrc(self, irc):
# Let's just be extra-special-careful here.
if irc not in self.ircstates:
self.ircstates[irc] = irclib.IrcState()
if irc not in self.lastmsg:
self.lastmsg[irc] = ircmsgs.ping('this is just a fake message')
if irc.afterConnect:
# We've probably been reloaded. Let's send some messages to get
# our IrcState objects up to current.
for channel in self.registryValue('channels'):
irc.queueMsg(ircmsgs.who(channel))
irc.queueMsg(ircmsgs.names(channel))
示例7: testPingResponse
def testPingResponse(self):
self.irc.feedMsg(ircmsgs.ping('123'))
self.assertEqual(ircmsgs.pong('123'), self.irc.takeMsg())