本文整理汇总了Python中epsilon.extime.Time.fromPOSIXTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Python Time.fromPOSIXTimestamp方法的具体用法?Python Time.fromPOSIXTimestamp怎么用?Python Time.fromPOSIXTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类epsilon.extime.Time
的用法示例。
在下文中一共展示了Time.fromPOSIXTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testScheduleWithEarlierTimedEvents
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def testScheduleWithEarlierTimedEvents(self):
"""
Like L{testSchedule}, but use a SubScheduler which has pre-existing
TimedEvents which are before the new runnable's scheduled time.
"""
now = self.clock.seconds()
when = Time.fromPOSIXTimestamp(now + 15)
null = NullRunnable(store=self.substore)
self.subscheduler.schedule(null, when)
runnable = self._scheduleRunner(now, 10)
self.clock.advance(11)
self.assertEqual(
list(self.subscheduler.scheduledTimes(runnable)),
[Time.fromPOSIXTimestamp(now + 20)])
self.assertEqual(
list(self.subscheduler.scheduledTimes(null)),
[Time.fromPOSIXTimestamp(now + 15)])
hook = self.store.findUnique(
_SubSchedulerParentHook,
_SubSchedulerParentHook.subStore == self.substoreItem)
self.assertEqual(
list(self.scheduler.scheduledTimes(hook)),
[Time.fromPOSIXTimestamp(now + 15)])
示例2: _testSchedule
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def _testSchedule(self, scheduler):
t1 = TestEvent(store=scheduler.store)
scheduler.schedule(t1, Time.fromPOSIXTimestamp(0))
self.failIf(self.calls,
"Should not have had any calls: %r" % (self.calls,))
self.assertIdentical(
scheduler._getNextEvent(Time.fromPOSIXTimestamp(1)).runnable, t1)
示例3: setUp
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def setUp(self):
self.clock = Clock()
self.dbdir = filepath.FilePath(self.mktemp())
self.store = Store(self.dbdir)
self.substoreItem = SubStore.createNew(self.store, ['sub'])
self.substore = self.substoreItem.open()
self.scheduler = IScheduler(self.store)
self.subscheduler = IScheduler(self.substore)
self.scheduler.callLater = self.clock.callLater
self.scheduler.now = lambda: Time.fromPOSIXTimestamp(self.clock.seconds())
self.subscheduler.now = lambda: Time.fromPOSIXTimestamp(self.clock.seconds())
IService(self.store).startService()
示例4: _setUpMsg
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def _setUpMsg(self):
"""
Install an innocuous incoming message in a newly-created store
@rtype: L{xquotient.exmess.Message}
"""
s = self._setUpStore()
m = Message.createIncoming(s, _Part(store=s), u'test://test')
m.subject = u'the subject'
m.sender = u'[email protected]'
m.senderDisplay = u'Sender'
m.recipient = u'[email protected]'
m.sentWhen = Time.fromPOSIXTimestamp(0)
m.receivedWhen = Time.fromPOSIXTimestamp(1)
m.classifyClean()
return m
示例5: testSchedule
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def testSchedule(self):
"""
Test the schedule method, as invoked from the run method of an item
being run by the subscheduler.
"""
now = self.clock.seconds()
runnable = self._scheduleRunner(now, 10)
self.clock.advance(11)
self.assertEqual(
list(self.subscheduler.scheduledTimes(runnable)),
[Time.fromPOSIXTimestamp(now + 20)])
hook = self.store.findUnique(
_SubSchedulerParentHook,
_SubSchedulerParentHook.subStore == self.substoreItem)
self.assertEqual(
list(self.scheduler.scheduledTimes(hook)),
[Time.fromPOSIXTimestamp(now + 20)])
示例6: test_now
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def test_now(self):
"""
The user store's L{IScheduler} powerup's C{now} method returns whatever
the site store's L{IScheduler} powerup's C{now} method returns.
"""
# I don't want the stubbed now method.
del self.scheduler.now
self.clock.advance(17)
self.assertEquals(
self.scheduler.now(),
Time.fromPOSIXTimestamp(self.clock.seconds()))
示例7: setMetadata
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def setMetadata(self, meta):
"""
Set the topic in the database
"""
self.channelItem.topic = unicode(meta['topic'])
self.channelItem.topicAuthor = unicode(meta['topic_author'])
self.channelItem.topicTime = Time.fromPOSIXTimestamp(meta['topic_date'])
sets = []
for p in self.users.itervalues():
d = defer.maybeDeferred(p.groupMetaUpdate, self, meta)
d.addErrback(self._ebUserCall, p=p)
sets.append(d)
defer.DeferredList(sets).addCallback(self._cbUserCall)
return defer.succeed(None)
示例8: test_blurbTimestampColumn
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def test_blurbTimestampColumn(self):
"""
Verify the L{xmantissa.ixmantissa.IColumn} implementation of
L{hyperbola_view._BlurbTimestampColumn}.
"""
col = hyperbola_view._BlurbTimestampColumn()
self.assertEqual(col.attributeID, 'dateCreated')
self.assertEqual(col.getType(), 'timestamp')
self.blogPostItem.dateCreated = Time.fromPOSIXTimestamp(345)
value = col.extractValue(None, self.blogPostItem)
self.assertEqual(value, 345)
self.assertIdentical(col.sortAttribute(), hyperblurb.Blurb.dateCreated)
comparable = col.toComparableValue(345)
self.assertEqual(comparable, self.blogPostItem.dateCreated)
示例9: testMultipleEventsPerTick
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def testMultipleEventsPerTick(self):
"""
Test running several runnables in a single tick of the subscheduler.
"""
now = self.clock.seconds()
runnables = [
self._scheduleRunner(now, 10),
self._scheduleRunner(now, 11),
self._scheduleRunner(now, 12)]
self.clock.advance(13)
for n, runnable in enumerate(runnables):
self.assertEqual(
list(self.subscheduler.scheduledTimes(runnable)),
[Time.fromPOSIXTimestamp(now + n + 20)])
hook = self.store.findUnique(
_SubSchedulerParentHook,
_SubSchedulerParentHook.subStore == self.substoreItem)
self.assertEqual(
list(self.scheduler.scheduledTimes(hook)),
[Time.fromPOSIXTimestamp(now + 20)])
示例10: _makeMessages
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def _makeMessages(self):
"""
Make 3 incoming messages
@rtype: C{list} of L{xquotient.exmess.Message}
"""
msgs = []
for (subject, timestamp) in ((u'3', 67), (u'1', 43), (u'2', 55)):
msgs.append(
testMessageFactory(
store=self.store,
read=False,
spam=False,
subject=subject,
receivedWhen=Time.fromPOSIXTimestamp(timestamp)))
return msgs
示例11: outfilter
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def outfilter(self, dbval, oself):
if dbval is None:
return None
return Time.fromPOSIXTimestamp(dbval / MICRO)
示例12: toComparableValue
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def toComparableValue(self, value):
"""
Convert a float from the client back into a timestamp.
"""
return Time.fromPOSIXTimestamp(value)
示例13: registerAddress
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def registerAddress(self, physicalURL, expiryTime):
self.physicalURL = physicalURL.toString()
self.expiryTime = Time.fromPOSIXTimestamp(time.time() + expiryTime)
return [(physicalURL, self.expiryTime)]
示例14: _scheduleRunner
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def _scheduleRunner(self, now, offset):
scheduledAt = Time.fromPOSIXTimestamp(now + offset)
rescheduleFor = Time.fromPOSIXTimestamp(now + offset + 10)
runnable = ScheduleCallingItem(store=self.substore, rescheduleFor=rescheduleFor)
self.subscheduler.schedule(runnable, scheduledAt)
return runnable
示例15: toComparableValue
# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromPOSIXTimestamp [as 别名]
def toComparableValue(self, value):
"""
Override L{AttributeColumn}'s implementation to return a L{Time} instance.
"""
return Time.fromPOSIXTimestamp(value)