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


Python system.strftime函数代码示例

本文整理汇总了Python中vistrails.core.system.strftime函数的典型用法代码示例。如果您正苦于以下问题:Python strftime函数的具体用法?Python strftime怎么用?Python strftime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了strftime函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save

 def save(self):
     return (self.id,
             self.type_id,
             self.name,
             self.user,
             strftime(self.mod_time, self.DATE_FORMAT),
             strftime(self.create_time, self.DATE_FORMAT),
             self.size,
             self.description,
             self.url)
开发者ID:danielballan,项目名称:VisTrails,代码行数:10,代码来源:entity.py

示例2: update

 def update(self, workflow_exec):
     self.workflow_exec = workflow_exec
     if self.workflow_exec is not None:
         self.name = "%s" % self.workflow_exec.db_ts_start
         self.user = self.workflow_exec.user
         self.mod_time = (
             strftime(self.workflow_exec.ts_end, '%d %b %Y %H:%M:%S')
             if self.workflow_exec.ts_end else '1 Jan 0000 00:00:00')
         self.create_time = (
             strftime(self.workflow_exec.ts_start, '%d %b %Y %H:%M:%S')
             if self.workflow_exec.ts_start else '1 Jan 0000 00:00:00')
         self.size = len(self.workflow_exec.item_execs)
         self.description = ""
         self.url = 'test'
         self.was_updated = True
开发者ID:cjh1,项目名称:VisTrails,代码行数:15,代码来源:workflow_exec.py

示例3: convertToStr

 def convertToStr(self, value, type):
     if value is not None:
         if type == 'date':
             return value.isoformat()
         elif type == 'datetime':
             return strftime(value, '%Y-%m-%d %H:%M:%S')
         else:
             return str(value)
     return ''
开发者ID:cjh1,项目名称:VisTrails,代码行数:9,代码来源:xml_dao.py

示例4: saveToHistory

 def saveToHistory(self):
     """ saveToHistory() -> None
     Save the current contents to the history
     
     """
     # Generate filename
     current = datetime.datetime.now()
     tmpDir = tempfile.gettempdir()
     fn = "hist_" + strftime(current, "%Y_%m_%d__%H_%M_%S") + "_" + str(current.microsecond) + ".png"
     fn = os.path.join(tmpDir, fn)
     if self.saveToPNG(fn):
         self._historyImages.append(fn)
开发者ID:pombredanne,项目名称:VisTrails,代码行数:12,代码来源:spreadsheet_cell.py

示例5: getParameterExploration

 def getParameterExploration(self):
     """ getParameterExploration() -> string
     Generates an XML string that represents the current
     parameter exploration, and which can be loaded with
     setParameterExploration().
     
     """
     # Construct xml for persisting parameter exploration
     escape_dict = {"'": "'", '"': """, "\n": "
"}
     timestamp = strftime(current_time(), "%Y-%m-%d %H:%M:%S")
     # TODO: For now, we use the timestamp as the 'name' - Later, we should set 'name' based on a UI input field
     xml = '\t<paramexp dims="%s" layout="%s" date="%s" name="%s">' % (
         str(self.peWidget.table.label.getCounts()),
         str(self.virtualCell.getConfiguration()[2]),
         timestamp,
         timestamp,
     )
     for i in xrange(self.peWidget.table.layout().count()):
         pEditor = self.peWidget.table.layout().itemAt(i).widget()
         if pEditor and isinstance(pEditor, QParameterSetEditor):
             firstParam = True
             for paramWidget in pEditor.paramWidgets:
                 paramInfo = paramWidget.param
                 interpolator = paramWidget.editor.stackedEditors.currentWidget()
                 intType = interpolator.exploration_name
                 # Write function tag prior to the first parameter of the function
                 if firstParam:
                     xml += '\n\t\t<function id="%s" alias="%s" name="%s">' % (
                         paramInfo.parent_id,
                         paramInfo.is_alias,
                         pEditor.info[0],
                     )
                     firstParam = False
                 # Write parameter tag
                 xml += '\n\t\t\t<param id="%s" dim="%s" interp="%s"' % (
                     paramInfo.id,
                     paramWidget.getDimension(),
                     intType,
                 )
                 if intType == "Linear Interpolation":
                     xml += ' min="%s" max="%s"' % (
                         interpolator.fromEdit.get_value(),
                         interpolator.toEdit.get_value(),
                     )
                 elif intType == "List":
                     xml += ' values="%s"' % escape(str(interpolator._str_values), escape_dict)
                 elif intType == "User-defined Function":
                     xml += ' code="%s"' % escape(interpolator.function, escape_dict)
                 xml += "/>"
             xml += "\n\t\t</function>"
     xml += "\n\t</paramexp>"
     return xml
开发者ID:hjanime,项目名称:VisTrails,代码行数:52,代码来源:pe_tab.py

示例6: getParameterExploration

    def getParameterExploration(self):
        """ getParameterExploration() -> ParameterExploration
        Generates a ParameterExploration object hat represents the current
        parameter exploration, and which can be loaded with
        setParameterExploration().
        
        """
        # Construct xml for persisting parameter exploration
        escape_dict = { "'":"&apos;", '"':'&quot;', '\n':'&#xa;' }
        palette = self.get_palette()
        id_scope = self.controller.id_scope
        functions = []
        for i in xrange(self.table.layout().count()):
            pEditor = self.table.layout().itemAt(i).widget()
            if pEditor and isinstance(pEditor, QParameterSetEditor):
                function = None
                firstParam = True
                for paramWidget in pEditor.paramWidgets:
                    paramInfo = paramWidget.param
                    interpolator = paramWidget.editor.stackedEditors.currentWidget()
                    intType = interpolator.exploration_name
                    # Write function tag prior to the first parameter of the function
                    if firstParam:
                        function = PEFunction(id=id_scope.getNewId(PEFunction.vtType),
                                              module_id=paramInfo.module_id,
                                              port_name=paramInfo.name,
                                              is_alias = 1 if paramInfo.is_alias else 0)
                        firstParam = False

                    if intType in ['Linear Interpolation', 'RGB Interpolation',
                                   'HSV Interpolation']:
                        value = '["%s", "%s"]' % (interpolator.fromEdit.get_value(),
                                                  interpolator.toEdit.get_value())
                    elif intType == 'List':
                        value = '%s' % escape(str(interpolator._str_values), escape_dict)
                    elif intType == 'User-defined Function':
                        value ='%s' % escape(interpolator.function, escape_dict)
                    # Write parameter tag
                    param = PEParam(id=id_scope.getNewId(PEParam.vtType),
                                    pos=paramInfo.pos,
                                    interpolator=intType,
                                    value=value,
                                    dimension=paramWidget.getDimension())
                    function.addParameter(param)
                functions.append(function)
        pe = ParameterExploration(dims=str(self.table.label.getCounts()),
                      layout=repr(palette.virtual_cell.getConfiguration()[2]),
                      date=strftime(current_time(), '%Y-%m-%d %H:%M:%S'),
                      user=getuser(),
                      functions=functions)
        return pe
开发者ID:cjh1,项目名称:VisTrails,代码行数:51,代码来源:pe_table.py

示例7: saveSession

    def saveSession(self):
        """saveSession() -> None
        Opens a File Save dialog and passes the filename to shell's saveSession.

        """
        default = 'visTrails' + '-' + strftime("%Y%m%d-%H%M.log")
        default = os.path.join(vistrails.core.system.vistrails_file_directory(),default)
        fileName = QtGui.QFileDialog.getSaveFileName(self,
                                                     "Save Session As..",
                                                     default,
                                                     "Log files (*.log)")
        if not fileName:
            return

        self.shell.saveSession(str(fileName))
开发者ID:cjh1,项目名称:VisTrails,代码行数:15,代码来源:shell.py

示例8: update

 def update(self, thumbnail):
     self.thumbnail = thumbnail
     if self.thumbnail is not None:
         # store in cache if not already there
         cache = ThumbnailCache.getInstance()
         cache._copy_thumbnails([thumbnail])
         self.name = os.path.basename(thumbnail)
         statinfo = os.stat(self.thumbnail)
         self.user = statinfo[stat.ST_UID]
         self.size = statinfo[stat.ST_SIZE]
         time = strftime(datetime(*localtime(statinfo[stat.ST_MTIME])[:6]),
                         '%d %b %Y %H:%M:%S')
         self.mod_time = ''
         self.create_time = time
         self.description = ""
         self.url = 'test'
         self.was_updated = True
开发者ID:cjh1,项目名称:VisTrails,代码行数:17,代码来源:thumbnail.py

示例9: convertToDB

    def convertToDB(self, value, type, db_type):
        if value is not None:
            if type == 'str':
                return "'" + str(value) + "'"
            elif type == 'long':
                return str(value)
            elif type == 'float':
                return str(value)
            elif type == 'int':
                return str(value)
            elif type == 'date':
                return "'" + value.isoformat() + "'"
            elif type == 'datetime':
                return "'" + strftime(value, '%Y-%m-%d %H:%M:%S') + "'"
            else:
                return str(value)

        return "''"
开发者ID:hjanime,项目名称:VisTrails,代码行数:18,代码来源:sql_dao.py

示例10: convertToDB

    def convertToDB(self, value, type, db_type):
        if value is not None:
            if type == "str":
                # return "'" + str(value).replace("'", "''") + "'"
                return str(value)
            elif type == "long":
                return str(value)
            elif type == "float":
                return str(value)
            elif type == "int":
                return str(value)
            elif type == "date":
                return value.isoformat()
            elif type == "datetime":
                return strftime(value, "%Y-%m-%d %H:%M:%S")
            else:
                return str(value)

        return None
开发者ID:hjanime,项目名称:VisTrails,代码行数:19,代码来源:sql_dao.py

示例11: _get_date

 def _get_date(self):
     if self.db_date is not None:
         return strftime(self.db_date, '%d %b %Y %H:%M:%S')
     return strftime(datetime(1900,1,1), '%d %b %Y %H:%M:%S')
开发者ID:danielballan,项目名称:VisTrails,代码行数:4,代码来源:action_annotation.py

示例12: int

            elif type == 'int':
                # note: on 64-bit machines int:s are 64-bit
                MIN_INT = -2147483648
                MAX_INT =  2147483647
                if db_type == 'int':
                    if int(value) < MIN_INT:
                        self.convertWarning(value, MIN_INT, type, db_type)
                        value = MIN_INT
                    if int(value) > MAX_INT:
                        self.convertWarning(value, MAX_INT, type, db_type)
                        value = MAX_INT
                return str(value)
            elif type == 'date':
                return value.isoformat()
            elif type == 'datetime':
                return strftime(value, '%Y-%m-%d %H:%M:%S')
            else:
                return str(value)

        return None

    def createSQLSelect(self, table, columns, whereMap, orderBy=None, 
                        forUpdate=False):
        columnStr = ', '.join(columns)
        whereStr = ''
        whereClause = ''
        values = []
        for column, value in whereMap.iteritems():
            whereStr += '%s%s = %%s' % \
                        (whereClause, column)
            values.append(value)
开发者ID:Nikea,项目名称:VisTrails,代码行数:31,代码来源:sql_dao.py


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