本文整理汇总了Python中isoweek.Week.isoformat方法的典型用法代码示例。如果您正苦于以下问题:Python Week.isoformat方法的具体用法?Python Week.isoformat怎么用?Python Week.isoformat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类isoweek.Week
的用法示例。
在下文中一共展示了Week.isoformat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPartAssignment
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import isoformat [as 别名]
def getPartAssignment(self, co=None, numWeekInit=-1, numYearInit=-1, numWeekEnd=-1, numYearEnd=-1):
'''
Prend en parametre un ou plusieurs doublets du type : ("nom", "bob") => WHERE NOM='Bob'
Permet de récupérer un objet python depuis la base de donnée en fonction d'un filtre.
Le type d'objet retournée varie en fonction de la classe fille qui l'appel.
'''
TEMPLATE_WHERE_NAT = Template("select A.ID_WORKER as _worker_num, A.FIRST_NAME as _worker_firstName, A.NAME as _worker_name, A.ADDRESS as _worker_position_address," + \
"E.ID_SITE _phase_site_num, E.NUM_SITE as _phase_site_numSite, E.NUM_WEEK as _phase_numWeek, E.NUM_YEAR as _phase_numYear " + \
"from (select w.ID as ID_WORKER, w.FIRST_NAME, w.NAME, p.ADDRESS " + \
"from WORKER w, POSITION p " + \
"where w.ID_POSITION = p.ID) A, " + \
"(select G.ID_WORKER, D.ID_SITE, D.NUM_SITE, D.NUM_WEEK, D.NUM_YEAR " + \
"from ASSIGNMENT G, (select B.ID_SITE, B.NUM_SITE, C.NUM_WEEK, C.NUM_YEAR, C.ID_PHASE " + \
"from (select SITE.ID as ID_SITE, SITE.NUM_SITE " + \
"from SITE " + \
"""where "$dateInit" >= SITE.DATE_INIT and "$dateEnd" <= SITE.DATE_END) B, """ + \
"(select PHASE.ID as ID_PHASE, PHASE.NUM_WEEK, PHASE.NUM_YEAR, PHASE.ID_SITE " + \
"from PHASE " + \
"where $numYearInit <= PHASE.NUM_YEAR and $numYearEnd >= PHASE.NUM_YEAR " + \
"and $numWeekInit <= PHASE.NUM_WEEK and $numWeekEnd >= PHASE.NUM_WEEK) C ) D " + \
"where G.ID_PHASE = D.ID_PHASE) E " + \
"where A.ID_WORKER = E.ID_WORKER")
from isoweek import Week
d1 = Week(numYearInit, numWeekInit).monday()
d2 = Week(numYearEnd, numWeekEnd).monday()
# Construit la requête SQL
request = TEMPLATE_WHERE_NAT.substitute(dateInit = d1.isoformat(), dateEnd = d2.isoformat(), numYearInit = numYearInit, numYearEnd = numYearEnd, numWeekInit = numWeekInit, numWeekEnd = numWeekEnd)
if self._verboseMode:
(request)
cursor = co[1]
# execution d'une requete
cursor.execute(request)
o = cursor.fetchall()
if o != None:
# construit et retourne un Objet du Systeme
res = set()
for x in o:
if self._verboseMode:
print(x)
res.add(self._buildObject(co, x))
return res
else:
return None
示例2: test_stringification
# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import isoformat [as 别名]
def test_stringification(self):
w = Week(2011, 20)
self.assertEqual(str(w), "2011W20")
self.assertEqual(w.isoformat(), "2011W20")
self.assertEqual(repr(w), "isoweek.Week(2011, 20)")