Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_from_indexes(self, name, indexes):
for child_filter in self.children:
try:
if not child_filter.match_indexes(
indexes, self.tzify):
return False
except MissingProperty as e:
logging.warning(
'calendar_query: Ignoring calendar object %s, due '
'to missing property %s', name, e.property_name)
return False
return True
def apply_time_range_vjournal(start, end, comp, tzify):
dtstart = comp.get('DTSTART')
if not dtstart:
raise MissingProperty('DTSTART')
if not (end > tzify(dtstart.dt)):
return False
if getattr(dtstart.dt, 'time', None) is not None:
return (start <= tzify(dtstart.dt))
else:
return (start < (tzify(dtstart.dt) + datetime.timedelta(1)))
def apply_time_range_vevent(start, end, comp, tzify):
dtstart = comp.get('DTSTART')
if not dtstart:
raise MissingProperty('DTSTART')
if not (end > tzify(dtstart.dt)):
return False
dtend = comp.get('DTEND')
if dtend:
if tzify(dtend.dt) < tzify(dtstart.dt):
logging.debug('Invalid DTEND < DTSTART')
return (start < tzify(dtend.dt))
duration = comp.get('DURATION')
if duration:
return (start < tzify(dtstart.dt) + duration.dt)
if getattr(dtstart.dt, 'time', None) is not None:
return (start <= tzify(dtstart.dt))
else:
def __init__(self, property_name):
super(MissingProperty, self).__init__(
"Property %r missing" % property_name)
self.property_name = property_name