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


Python system.time_strptime函数代码示例

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


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

示例1: convertFromStr

 def convertFromStr(self, value, type):
     if value is not None:
         if type == 'str':
             return str(value)
         elif value.strip() != '':
             if type == 'long':
                 try:
                     return long(value)
                 except ValueError:
                     return -1
             elif type == 'float':
                 return float(value)
             elif type == 'int':
                 try:
                     return int(value)
                 except ValueError:
                     if 'False' == value:
                         return -1
                     else:
                         return 0
             elif type == 'date':
                 return date(*time_strptime(value, '%Y-%m-%d')[0:3])
             elif type == 'datetime':
                 return datetime(*time_strptime(value, '%Y-%m-%d %H:%M:%S')[0:6])
     return None
开发者ID:Nikea,项目名称:VisTrails,代码行数:25,代码来源:xml_dao.py

示例2: convert_from_str

        def convert_from_str(value,type):
            def bool_conv(x):
                s = str(x).upper()
                if s == 'TRUE':
                    return True
                if s == 'FALSE':
                    return False

            if value is not None:
                if type == 'str':
                    return str(value)
                elif value.strip() != '':
                    if type == 'long':
                        return long(value)
                    elif type == 'float':
                        return float(value)
                    elif type == 'int':
                        return int(value)
                    elif type == 'bool':
                        return bool_conv(value)
                    elif type == 'date':
                        return date(*time_strptime(value, '%Y-%m-%d')[0:3])
                    elif type == 'datetime':
                        return datetime(*time_strptime(value, '%Y-%m-%d %H:%M:%S')[0:6])
            return None
开发者ID:hjanime,项目名称:VisTrails,代码行数:25,代码来源:locator.py

示例3: convertFromStr

 def convertFromStr(self, value, type):
     if value is not None:
         if type == "str":
             return str(value)
         elif value.strip() != "":
             if type == "long":
                 return long(value)
             elif type == "float":
                 return float(value)
             elif type == "int":
                 return int(value)
             elif type == "date":
                 return date(*time_strptime(value, "%Y-%m-%d")[0:3])
             elif type == "datetime":
                 return datetime(*time_strptime(value, "%Y-%m-%d %H:%M:%S")[0:6])
     return None
开发者ID:pombredanne,项目名称:VisTrails,代码行数:16,代码来源:xml_dao.py

示例4: get_db_modification_time

    def get_db_modification_time(self, obj_type=None):
        if obj_type is None:
            if self.obj_type is None:
                obj_type = DBVistrail.vtType 
            else:
                obj_type = self.obj_type

        ts = io.get_db_object_modification_time(self.get_connection(),
                                                self.obj_id,
                                                obj_type)
        ts = datetime(*time_strptime(str(ts).strip(), '%Y-%m-%d %H:%M:%S')[0:6])
        return ts
开发者ID:hjanime,项目名称:VisTrails,代码行数:12,代码来源:locator.py

示例5: convertFromDB

 def convertFromDB(self, value, type, db_type):
     if value is not None:
         if type == "str":
             return str(value)
         elif type == "long":
             return long(value)
         elif type == "float":
             return float(value)
         elif type == "int":
             return int(value)
         elif type == "date":
             if db_type == "date":
                 return value
             else:
                 return date(*time_strptime(str(value), "%Y-%m-%d")[0:3])
         elif type == "datetime":
             if db_type == "datetime":
                 return value
             else:
                 return datetime(*time_strptime(str(value), "%Y-%m-%d %H:%M:%S")[0:6])
     return None
开发者ID:hjanime,项目名称:VisTrails,代码行数:21,代码来源:sql_dao.py

示例6: convertFromDB

 def convertFromDB(self, value, type, db_type):
     if value is not None:
         if type == 'str':
             return str(value)
         elif type == 'long':
             return long(value)
         elif type == 'float':
             return float(value)
         elif type == 'int':
             return int(value)
         elif type == 'date':
             if db_type == 'date':
                 return value
             else:
                 return date(*time_strptime(str(value), '%Y-%m-%d')[0:3])
         elif type == 'datetime':
             if db_type == 'datetime':
                 return value
             else:
                 return datetime(*time_strptime(str(value),
                                                '%Y-%m-%d %H:%M:%S')[0:6])
     return None
开发者ID:cjh1,项目名称:VisTrails,代码行数:22,代码来源:sql_dao.py

示例7: _convert_value_node

 def _convert_value_node(self, node):
     """Convert a 'value' node (i.e. anything but 'key') into a Python data
     structure"""
     if node.tag == 'string':
         return self._content(node)
     elif node.tag == 'integer':
         return int(self._content(node))
     elif node.tag == 'real':
         return float(self._content(node))
     elif node.tag == 'date': #  <date>2004-07-05T13:29:29Z</date>
         return datetime.datetime(
             *time_strptime(self._content(node), '%Y-%m-%dT%H:%M:%SZ')[:5])
     elif node.tag == 'array':
         return [self._convert_value_node(n) for n in node.getchildren()]
     elif node.tag == 'dict':
         return dict([(self._content(n), self._convert_value_node(m))
             for n, m in group(node.getchildren(), 2)])
     else:
         raise ValueError(node.tag)
开发者ID:danielballan,项目名称:VisTrails,代码行数:19,代码来源:osx.py

示例8: match

 def match(self, vistrail, action):
     if not action.date:
         return False
     t = time.mktime(time_strptime(action.date, "%d %b %Y %H:%M:%S"))
     return t >= self.date
开发者ID:Nikea,项目名称:VisTrails,代码行数:5,代码来源:version.py

示例9: _set_date

 def _set_date(self, date):
     if isinstance(date, datetime):
         self.db_date = date
     elif isinstance(date, basestring) and date.strip() != '':
         newDate = datetime(*time_strptime(date, '%d %b %Y %H:%M:%S')[0:6])
         self.db_date = newDate
开发者ID:danielballan,项目名称:VisTrails,代码行数:6,代码来源:action_annotation.py

示例10: convertDate

def convertDate(date):
    if date is not None and date != '':
        return datetime(*time_strptime(date, '%d %b %Y %H:%M:%S')[0:6])
    return datetime(1900, 1, 1)
开发者ID:hjanime,项目名称:VisTrails,代码行数:4,代码来源:v0_3_1.py

示例11: match

 def match(self, entity):
     if not entity.mod_time:
         return False
     t = time.mktime(time_strptime(entity.mod_time, "%d %b %Y %H:%M:%S"))
     return t >= self.date
开发者ID:cjh1,项目名称:VisTrails,代码行数:5,代码来源:search.py

示例12: match

 def match(self, controller, action):
     if not action.date:
         return False
     t = time.mktime(time_strptime(action.date, "%d %b %Y %H:%M:%S"))
     return t <= self.date
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:5,代码来源:version.py


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