本文整理汇总了Python中isoweek.Week.sunday方法的典型用法代码示例。如果您正苦于以下问题:Python Week.sunday方法的具体用法?Python Week.sunday怎么用?Python Week.sunday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类isoweek.Week
的用法示例。
在下文中一共展示了Week.sunday方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _task_completed
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import sunday [as 别名]
def _task_completed(user_id, task_id, year, week_number):
""" Return true if a task is completed for this specific user and week """
week = Week(year, week_number)
monday = week.monday().isoformat()
next_monday = week.sunday() + timedelta(days=1)
return _db.is_task_completed(user_id, task_id, monday, next_monday)
示例2: test_days
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import sunday [as 别名]
def test_days(self):
w = Week(2011, 20)
self.assertEqual(w.monday().isoformat(), "2011-05-16")
self.assertEqual(w.tuesday().isoformat(), "2011-05-17")
self.assertEqual(w.wednesday().isoformat(), "2011-05-18")
self.assertEqual(w.thursday().isoformat(), "2011-05-19")
self.assertEqual(w.friday().isoformat(), "2011-05-20")
self.assertEqual(w.saturday().isoformat(), "2011-05-21")
self.assertEqual(w.sunday().isoformat(), "2011-05-22")
self.assertEqual(w.day(0).isoformat(), "2011-05-16")
self.assertEqual(w.day(-1).isoformat(), "2011-05-15")
self.assertEqual(w.day(10).isoformat(), "2011-05-26")
days = w.days()
self.assertEqual(len(days), 7)
self.assertEqual(days[0].isoformat(), "2011-05-16")
self.assertEqual(days[-1].isoformat(), "2011-05-22")
from datetime import date
self.assertFalse(w.contains(date(2011,5,15)))
self.assertTrue(w.contains(date(2011,5,16)))
self.assertTrue(w.contains(date(2011,5,22)))
self.assertFalse(w.contains(date(2011,5,23)))
示例3: for_week
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import sunday [as 别名]
def for_week(self, year, week_no):
from isoweek import Week
week = Week(year, week_no)
return TimeEntry.objects.filter(date__gte=week.monday(), date__lte=week.sunday())
示例4: int
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import sunday [as 别名]
if infoboks.has_param(commonargs['year']) and infoboks.has_param(commonargs['week']):
year = int(re.sub(ur'<\!--.+?-->', ur'', unicode(infoboks.parameters[commonargs['year']])).strip())
startweek = int(re.sub(ur'<\!--.+?-->', ur'', unicode(infoboks.parameters[commonargs['week']])).strip())
if infoboks.has_param(commonargs['week2']):
endweek = re.sub(ur'<\!--.+?-->', ur'', unicode(infoboks.parameters[commonargs['week2']])).strip()
if endweek == '':
endweek = startweek
else:
endweek = startweek
endweek = int(endweek)
startweek = Week(year, startweek)
endweek = Week(year, endweek)
start = wiki_tz.localize(datetime.combine(startweek.monday(), dt_time(0, 0, 0)))
end = wiki_tz.localize(datetime.combine(endweek.sunday(), dt_time(23, 59, 59)))
elif infoboks.has_param(ibcfg['start']) and infoboks.has_param(ibcfg['end']):
startdt = infoboks.parameters[ibcfg['start']].value
enddt = infoboks.parameters[ibcfg['end']].value
start = wiki_tz.localize(datetime.strptime(startdt + ' 00 00 00', '%Y-%m-%d %H %M %S'))
end = wiki_tz.localize(datetime.strptime(enddt + ' 23 59 59', '%Y-%m-%d %H %M %S'))
else:
log('!! fant ikke datoer')
sys.exit(0)
year = start.isocalendar()[0]
startweek = start.isocalendar()[1]
endweek = end.isocalendar()[1]
figname = config['plot']['figname'] % {'year': year, 'week': startweek}