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


Python Time.fromISO8601TimeAndDate方法代码示例

本文整理汇总了Python中epsilon.extime.Time.fromISO8601TimeAndDate方法的典型用法代码示例。如果您正苦于以下问题:Python Time.fromISO8601TimeAndDate方法的具体用法?Python Time.fromISO8601TimeAndDate怎么用?Python Time.fromISO8601TimeAndDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在epsilon.extime.Time的用法示例。


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

示例1: _parse_get_bucket

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
    def _parse_get_bucket(self, xml_bytes):
        root = XML(xml_bytes)
        name = root.findtext("Name")
        prefix = root.findtext("Prefix")
        marker = root.findtext("Marker")
        max_keys = root.findtext("MaxKeys")
        is_truncated = root.findtext("IsTruncated")
        contents = []

        for content_data in root.findall("Contents"):
            key = content_data.findtext("Key")
            date_text = content_data.findtext("LastModified")
            modification_date = Time.fromISO8601TimeAndDate(
                date_text).asDatetime()
            etag = content_data.findtext("ETag")
            size = content_data.findtext("Size")
            storage_class = content_data.findtext("StorageClass")
            owner_id = content_data.findtext("Owner/ID")
            owner_display_name = content_data.findtext("Owner/DisplayName")
            owner = ItemOwner(owner_id, owner_display_name)
            content_item = BucketItem(key, modification_date, etag, size,
                                      storage_class, owner)
            contents.append(content_item)

        common_prefixes = []
        for prefix_data in root.findall("CommonPrefixes"):
            common_prefixes.append(prefix_data.text)

        return BucketListing(name, prefix, marker, max_keys, is_truncated,
                             contents, common_prefixes)
开发者ID:zancas,项目名称:txaws,代码行数:32,代码来源:client.py

示例2: peerRequestedAppointment

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
 def peerRequestedAppointment(self, whom, when):
     app = Appointment(
         store=self.store, when=Time.fromISO8601TimeAndDate(when),
         withWhomUsername=whom.localpart, withWhomDomain=whom.domain,
         withWhomShareID=whom.shareID, remoteID=whom.shareID)
     role = getPrimaryRole(self.store, u"%[email protected]%s" % (whom.localpart, whom.domain), True)
     appointmentID = role.shareItem(app, interfaces=[IMessageReceiver]).shareID
     return {'appointmentID': appointmentID}
开发者ID:rcarmo,项目名称:divmod.org,代码行数:10,代码来源:cal.py

示例3: _parse_list_buckets

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
 def _parse_list_buckets(self, xml_bytes):
     """
     Parse XML bucket list response.
     """
     root = XML(xml_bytes)
     buckets = []
     for bucket_data in root.find("Buckets"):
         name = bucket_data.findtext("Name")
         date_text = bucket_data.findtext("CreationDate")
         date_time = Time.fromISO8601TimeAndDate(date_text).asDatetime()
         bucket = Bucket(name, date_time)
         buckets.append(bucket)
     return buckets
开发者ID:zancas,项目名称:txaws,代码行数:15,代码来源:client.py

示例4: formatEntry

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
    def formatEntry(self, formatting, entry):
        """
        Format an Superfeedr entry element according to the formatting type.
        """
        parts = [
            getattr(entry, elemName, None) or u'<unknown>'
            for elemName in formatting]
        parts = u' -- '.join(map(str, parts))

        try:
            timestamp = Time.fromISO8601TimeAndDate(
                str(entry.published)).asHumanly(tzinfo=const.timezone)
            timestamp = u' (%s)' % (timestamp,)
        except ValueError:
            timestamp = u''

        return u'%s%s' % (parts, timestamp)
开发者ID:mithrandi,项目名称:eridanus,代码行数:19,代码来源:feedupdates.py

示例5: Store

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
        s = Store()
        err = self.assertRaises(AttributeError,
                                    FunkyItem, store=s, name="foo")
        self.assertEqual(str(err), "'FunkyItem' can't set attribute 'name'")


class WhiteboxComparableTest(TestCase):
    def test_likeRejectsIllegalOperations(self):
        """
        Test that invoking the underlying method which provides the interface
        to the LIKE operator raises a TypeError if it is invoked with too few
        arguments.
        """
        self.assertRaises(TypeError, Comparable()._like, 'XYZ')

someRandomDate = Time.fromISO8601TimeAndDate("1980-05-29")

class DatedThing(Item):
    date = timestamp(default=someRandomDate)

class CreationDatedThing(Item):
    creationDate = timestamp(defaultFactory=lambda : Time())

class StructuredDefaultTestCase(TestCase):
    def testTimestampDefault(self):
        s = Store()
        sid = DatedThing(store=s).storeID
        self.assertEqual(s.getItemByID(sid).date,
                          someRandomDate)

    def testTimestampNow(self):
开发者ID:perkinslr,项目名称:axiom-py3,代码行数:33,代码来源:test_attributes.py

示例6: unicode

# 需要导入模块: from epsilon.extime import Time [as 别名]
# 或者: from epsilon.extime.Time import fromISO8601TimeAndDate [as 别名]
    @raise ValueError: If no XSI type information could be found

    @rtype: C{unicode}
    @return: The XSI type string
    """
    xsiType = elem.get(XSI + 'type')
    if xsiType is None:
        xsiType = elem.get(XSI2001 + 'type')

    if xsiType is not None:
        return unicode(xsiType, 'ascii')

    raise ValueError(u'"%s" has no XSI type information' % (elem.tag,))


_xsiTypes = {
    u'xsd:string': unicode,
    u'xsd:int': int,
    u'xsd:boolean': lambda t: t.lower() == 'true',
    u'xsd:dateTime': lambda t: Time.fromISO8601TimeAndDate(t),
    }

def getValueFromXSIType(elem, xsiType=None):
    """
    Convert C{elem} to it's Python value based on it's C{xsi:type} attriubte.
    """
    if xsiType is None:
        xsiType = getXSIType(elem)
    return _xsiTypes[xsiType](elem.text)
开发者ID:mithrandi,项目名称:eridanus,代码行数:31,代码来源:soap.py


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