当前位置: 首页>>代码示例>>Python>>正文


Python Week.isoformat方法代码示例

本文整理汇总了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
开发者ID:gpierre42,项目名称:optraj,代码行数:50,代码来源:AssignmentDAO.py

示例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)")
开发者ID:Zopieux,项目名称:isoweek,代码行数:7,代码来源:test_isoweek.py


注:本文中的isoweek.Week.isoformat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。