本文整理汇总了Python中dateutil.zoneinfo.get_zonefile_instance方法的典型用法代码示例。如果您正苦于以下问题:Python zoneinfo.get_zonefile_instance方法的具体用法?Python zoneinfo.get_zonefile_instance怎么用?Python zoneinfo.get_zonefile_instance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dateutil.zoneinfo
的用法示例。
在下文中一共展示了zoneinfo.get_zonefile_instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __get_kiritimati_resolve_imaginary_test
# 需要导入模块: from dateutil import zoneinfo [as 别名]
# 或者: from dateutil.zoneinfo import get_zonefile_instance [as 别名]
def __get_kiritimati_resolve_imaginary_test():
# In the 2018d release of the IANA database, the Kiritimati "imaginary day"
# data was corrected, so if the system zoneinfo is older than 2018d, the
# Kiritimati test will fail.
tzi = tz.gettz('Pacific/Kiritimati')
new_version = False
if not tz.datetime_exists(datetime(1995, 1, 1, 12, 30), tzi):
zif = zoneinfo.get_zonefile_instance()
if zif.metadata is not None:
new_version = zif.metadata['tzversion'] >= '2018d'
if new_version:
tzi = zif.get('Pacific/Kiritimati')
else:
new_version = True
if new_version:
dates = (datetime(1994, 12, 31, 12, 30), datetime(1995, 1, 1, 12, 30))
else:
dates = (datetime(1995, 1, 1, 12, 30), datetime(1995, 1, 2, 12, 30))
return (tzi, ) + dates
示例2: gettz
# 需要导入模块: from dateutil import zoneinfo [as 别名]
# 或者: from dateutil.zoneinfo import get_zonefile_instance [as 别名]
def gettz(self, name):
zoneinfo_file = zoneinfo.get_zonefile_instance()
return zoneinfo_file.get(name)
示例3: testZoneInfoInstanceCaching
# 需要导入模块: from dateutil import zoneinfo [as 别名]
# 或者: from dateutil.zoneinfo import get_zonefile_instance [as 别名]
def testZoneInfoInstanceCaching(self):
zif_0 = zoneinfo.get_zonefile_instance()
zif_1 = zoneinfo.get_zonefile_instance()
self.assertIs(zif_0, zif_1)
示例4: testZoneInfoNewInstance
# 需要导入模块: from dateutil import zoneinfo [as 别名]
# 或者: from dateutil.zoneinfo import get_zonefile_instance [as 别名]
def testZoneInfoNewInstance(self):
zif_0 = zoneinfo.get_zonefile_instance()
zif_1 = zoneinfo.get_zonefile_instance(new_instance=True)
zif_2 = zoneinfo.get_zonefile_instance()
self.assertIsNot(zif_0, zif_1)
self.assertIs(zif_1, zif_2)
示例5: testPickleZoneFileGettz
# 需要导入模块: from dateutil import zoneinfo [as 别名]
# 或者: from dateutil.zoneinfo import get_zonefile_instance [as 别名]
def testPickleZoneFileGettz(self):
zoneinfo_file = zoneinfo.get_zonefile_instance()
tzi = zoneinfo_file.get('America/New_York')
self.assertIsNot(tzi, None)
self.assertPicklable(tzi)