本文整理汇总了Python中pycalendar.datetime.DateTime.setHHMMSS方法的典型用法代码示例。如果您正苦于以下问题:Python DateTime.setHHMMSS方法的具体用法?Python DateTime.setHHMMSS怎么用?Python DateTime.setHHMMSS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycalendar.datetime.DateTime
的用法示例。
在下文中一共展示了DateTime.setHHMMSS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ComponentRecur
# 需要导入模块: from pycalendar.datetime import DateTime [as 别名]
# 或者: from pycalendar.datetime.DateTime import setHHMMSS [as 别名]
#.........这里部分代码省略.........
self.mAdjustFuture = False
self.mAdjustPrior = False
else:
self.mMapKey = self.mapKey(self.mUID)
self._resetRecurrenceSet()
def validate(self, doFix=False):
"""
Validate the data in this component and optionally fix any problems. Return
a tuple containing two lists: the first describes problems that were fixed, the
second problems that were not fixed. Caller can then decide what to do with unfixed
issues.
"""
# Do normal checks
fixed, unfixed = super(ComponentRecur, self).validate(doFix)
# Check that any UNTIL value matches that for DTSTART
if self.mHasStart and self.mRecurrences:
dtutc = self.mStart.duplicateAsUTC()
for rrule in self.mRecurrences.getRules():
if rrule.getUseUntil():
if rrule.getUntil().isDateOnly() ^ self.mStart.isDateOnly():
logProblem = "[%s] Value types must match: %s, %s" % (
self.getType(),
definitions.cICalProperty_DTSTART,
definitions.cICalValue_RECUR_UNTIL,
)
if doFix:
rrule.getUntil().setDateOnly(self.mStart.isDateOnly())
if not self.mStart.isDateOnly():
rrule.getUntil().setHHMMSS(dtutc.getHours(), dtutc.getMinutes(), dtutc.getSeconds())
rrule.getUntil().setTimezone(Timezone(utc=True))
self.mRecurrences.changed()
fixed.append(logProblem)
else:
unfixed.append(logProblem)
return fixed, unfixed
def check_cardinality_STATUS_Fix(self, fixed, unfixed, doFix):
"""
Special for bug with STATUS where STATUS:CANCELLED is added alongside
another STATUS. In this case we want STATUS:CANCELLED to win.
"""
for propname in self.propertyCardinality_STATUS_Fix:
if self.countProperty(propname) > 1:
logProblem = "[%s] Too many properties: %s" % (self.getType(), propname)
if doFix:
# Check that one of them is STATUS:CANCELLED
for prop in self.getProperties(propname):
if prop.getTextValue().getValue().upper() == definitions.cICalProperty_STATUS_CANCELLED:
self.removeProperties(propname)
self.addProperty(Property(propname, definitions.cICalProperty_STATUS_CANCELLED))
fixed.append(logProblem)
break
else:
unfixed.append(logProblem)
else:
unfixed.append(logProblem)
def _resetRecurrenceSet(self):
示例2: VFreeBusy
# 需要导入模块: from pycalendar.datetime import DateTime [as 别名]
# 或者: from pycalendar.datetime.DateTime import setHHMMSS [as 别名]
class VFreeBusy(Component):
propertyCardinality_1 = (
definitions.cICalProperty_DTSTAMP,
definitions.cICalProperty_UID,
)
propertyCardinality_0_1 = (
definitions.cICalProperty_CONTACT,
definitions.cICalProperty_DTSTART,
definitions.cICalProperty_DTEND,
definitions.cICalProperty_ORGANIZER,
definitions.cICalProperty_URL,
)
propertyValueChecks = ICALENDAR_VALUE_CHECKS
def __init__(self, parent=None):
super(VFreeBusy, self).__init__(parent=parent)
self.mStart = DateTime()
self.mHasStart = False
self.mEnd = DateTime()
self.mHasEnd = False
self.mDuration = False
self.mCachedBusyTime = False
self.mSpanPeriod = None
self.mBusyTime = None
def duplicate(self, parent=None):
other = super(VFreeBusy, self).duplicate(parent=parent)
other.mStart = self.mStart.duplicate()
other.mHasStart = self.mHasStart
other.mEnd = self.mEnd.duplicate()
other.mHasEnd = self.mHasEnd
other.mDuration = self.mDuration
other.mCachedBusyTime = False
other.mBusyTime = None
return other
def getType(self):
return definitions.cICalComponent_VFREEBUSY
def getMimeComponentName(self):
return itipdefinitions.cICalMIMEComponent_VFREEBUSY
def finalise(self):
# Do inherited
super(VFreeBusy, self).finalise()
# Get DTSTART
temp = self.loadValueDateTime(definitions.cICalProperty_DTSTART)
self.mHasStart = temp is not None
if self.mHasStart:
self.mStart = temp
# Get DTEND
temp = self.loadValueDateTime(definitions.cICalProperty_DTEND)
if temp is None:
# Try DURATION instead
temp = self.loadValueDuration(definitions.cICalProperty_DURATION)
if temp is not None:
self.mEnd = self.mStart + temp
self.mDuration = True
else:
# Force end to start, which will then be fixed to sensible
# value later
self.mEnd = self.mStart
else:
self.mHasEnd = True
self.mDuration = False
self.mEnd = temp
def fixStartEnd(self):
# End is always greater than start if start exists
if self.mHasStart and self.mEnd <= self.mStart:
# Use the start
self.mEnd = self.mStart.duplicate()
self.mDuration = False
# Adjust to appropiate non-inclusive end point
if self.mStart.isDateOnly():
self.mEnd.offsetDay(1)
# For all day events it makes sense to use duration
self.mDuration = True
else:
# Use end of current day
self.mEnd.offsetDay(1)
self.mEnd.setHHMMSS(0, 0, 0)
def getStart(self):
return self.mStart
#.........这里部分代码省略.........