本文整理匯總了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)