mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 07:22:37 -07:00
Update pytz library
This commit is contained in:
parent
4eb7e03b67
commit
492d28ea37
135 changed files with 346 additions and 324 deletions
|
@ -8,9 +8,9 @@ See the datetime section of the Python Library Reference for information
|
||||||
on how to use these modules.
|
on how to use these modules.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# The Olson database is updated several times a year.
|
# The IANA (nee Olson) database is updated several times a year.
|
||||||
OLSON_VERSION = '2014j'
|
OLSON_VERSION = '2016f'
|
||||||
VERSION = '2014.10' # Switching to pip compatible version numbering.
|
VERSION = '2016.6.1' # Switching to pip compatible version numbering.
|
||||||
__version__ = VERSION
|
__version__ = VERSION
|
||||||
|
|
||||||
OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling
|
OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling
|
||||||
|
@ -25,11 +25,6 @@ __all__ = [
|
||||||
|
|
||||||
import sys, datetime, os.path, gettext
|
import sys, datetime, os.path, gettext
|
||||||
|
|
||||||
try:
|
|
||||||
from pkg_resources import resource_stream
|
|
||||||
except ImportError:
|
|
||||||
resource_stream = None
|
|
||||||
|
|
||||||
from pytz.exceptions import AmbiguousTimeError
|
from pytz.exceptions import AmbiguousTimeError
|
||||||
from pytz.exceptions import InvalidTimeError
|
from pytz.exceptions import InvalidTimeError
|
||||||
from pytz.exceptions import NonExistentTimeError
|
from pytz.exceptions import NonExistentTimeError
|
||||||
|
@ -57,7 +52,7 @@ except NameError: # Python 3.x
|
||||||
...
|
...
|
||||||
UnicodeEncodeError: ...
|
UnicodeEncodeError: ...
|
||||||
"""
|
"""
|
||||||
s.encode('US-ASCII') # Raise an exception if not ASCII
|
s.encode('ASCII') # Raise an exception if not ASCII
|
||||||
return s # But return the original string - not a byte string.
|
return s # But return the original string - not a byte string.
|
||||||
|
|
||||||
else: # Python 2.x
|
else: # Python 2.x
|
||||||
|
@ -73,7 +68,7 @@ else: # Python 2.x
|
||||||
...
|
...
|
||||||
UnicodeEncodeError: ...
|
UnicodeEncodeError: ...
|
||||||
"""
|
"""
|
||||||
return s.encode('US-ASCII')
|
return s.encode('ASCII')
|
||||||
|
|
||||||
|
|
||||||
def open_resource(name):
|
def open_resource(name):
|
||||||
|
@ -88,11 +83,17 @@ def open_resource(name):
|
||||||
raise ValueError('Bad path segment: %r' % part)
|
raise ValueError('Bad path segment: %r' % part)
|
||||||
filename = os.path.join(os.path.dirname(__file__),
|
filename = os.path.join(os.path.dirname(__file__),
|
||||||
'zoneinfo', *name_parts)
|
'zoneinfo', *name_parts)
|
||||||
if not os.path.exists(filename) and resource_stream is not None:
|
if not os.path.exists(filename):
|
||||||
# http://bugs.launchpad.net/bugs/383171 - we avoid using this
|
# http://bugs.launchpad.net/bugs/383171 - we avoid using this
|
||||||
# unless absolutely necessary to help when a broken version of
|
# unless absolutely necessary to help when a broken version of
|
||||||
# pkg_resources is installed.
|
# pkg_resources is installed.
|
||||||
return resource_stream(__name__, 'zoneinfo/' + name)
|
try:
|
||||||
|
from pkg_resources import resource_stream
|
||||||
|
except ImportError:
|
||||||
|
resource_stream = None
|
||||||
|
|
||||||
|
if resource_stream is not None:
|
||||||
|
return resource_stream(__name__, 'zoneinfo/' + name)
|
||||||
return open(filename, 'rb')
|
return open(filename, 'rb')
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ def resource_exists(name):
|
||||||
# module, as well as the Zope3 i18n package. Perhaps we should just provide
|
# module, as well as the Zope3 i18n package. Perhaps we should just provide
|
||||||
# the POT file and translations, and leave it up to callers to make use
|
# the POT file and translations, and leave it up to callers to make use
|
||||||
# of them.
|
# of them.
|
||||||
#
|
#
|
||||||
# t = gettext.translation(
|
# t = gettext.translation(
|
||||||
# 'pytz', os.path.join(os.path.dirname(__file__), 'locales'),
|
# 'pytz', os.path.join(os.path.dirname(__file__), 'locales'),
|
||||||
# fallback=True
|
# fallback=True
|
||||||
|
@ -123,7 +124,7 @@ def resource_exists(name):
|
||||||
_tzinfo_cache = {}
|
_tzinfo_cache = {}
|
||||||
|
|
||||||
def timezone(zone):
|
def timezone(zone):
|
||||||
r''' Return a datetime.tzinfo implementation for the given timezone
|
r''' Return a datetime.tzinfo implementation for the given timezone
|
||||||
|
|
||||||
>>> from datetime import datetime, timedelta
|
>>> from datetime import datetime, timedelta
|
||||||
>>> utc = timezone('UTC')
|
>>> utc = timezone('UTC')
|
||||||
|
@ -241,13 +242,13 @@ class UTC(datetime.tzinfo):
|
||||||
return "UTC"
|
return "UTC"
|
||||||
|
|
||||||
|
|
||||||
UTC = utc = UTC() # UTC is a singleton
|
UTC = utc = UTC() # UTC is a singleton
|
||||||
|
|
||||||
|
|
||||||
def _UTC():
|
def _UTC():
|
||||||
"""Factory function for utc unpickling.
|
"""Factory function for utc unpickling.
|
||||||
|
|
||||||
Makes sure that unpickling a utc instance always returns the same
|
Makes sure that unpickling a utc instance always returns the same
|
||||||
module global.
|
module global.
|
||||||
|
|
||||||
These examples belong in the UTC class above, but it is obscured; or in
|
These examples belong in the UTC class above, but it is obscured; or in
|
||||||
|
@ -329,7 +330,7 @@ class _CountryTimezoneDict(LazyDict):
|
||||||
zone_tab = open_resource('zone.tab')
|
zone_tab = open_resource('zone.tab')
|
||||||
try:
|
try:
|
||||||
for line in zone_tab:
|
for line in zone_tab:
|
||||||
line = line.decode('US-ASCII')
|
line = line.decode('UTF-8')
|
||||||
if line.startswith('#'):
|
if line.startswith('#'):
|
||||||
continue
|
continue
|
||||||
code, coordinates, zone = line.split(None, 4)[:3]
|
code, coordinates, zone = line.split(None, 4)[:3]
|
||||||
|
@ -357,7 +358,7 @@ class _CountryNameDict(LazyDict):
|
||||||
zone_tab = open_resource('iso3166.tab')
|
zone_tab = open_resource('iso3166.tab')
|
||||||
try:
|
try:
|
||||||
for line in zone_tab.readlines():
|
for line in zone_tab.readlines():
|
||||||
line = line.decode('US-ASCII')
|
line = line.decode('UTF-8')
|
||||||
if line.startswith('#'):
|
if line.startswith('#'):
|
||||||
continue
|
continue
|
||||||
code, name = line.split(None, 1)
|
code, name = line.split(None, 1)
|
||||||
|
@ -404,9 +405,11 @@ class _FixedOffset(datetime.tzinfo):
|
||||||
|
|
||||||
def normalize(self, dt, is_dst=False):
|
def normalize(self, dt, is_dst=False):
|
||||||
'''Correct the timezone information on the given datetime'''
|
'''Correct the timezone information on the given datetime'''
|
||||||
|
if dt.tzinfo is self:
|
||||||
|
return dt
|
||||||
if dt.tzinfo is None:
|
if dt.tzinfo is None:
|
||||||
raise ValueError('Naive time - no tzinfo set')
|
raise ValueError('Naive time - no tzinfo set')
|
||||||
return dt.replace(tzinfo=self)
|
return dt.astimezone(self)
|
||||||
|
|
||||||
|
|
||||||
def FixedOffset(offset, _tzinfos = {}):
|
def FixedOffset(offset, _tzinfos = {}):
|
||||||
|
@ -599,6 +602,7 @@ all_timezones = \
|
||||||
'America/Eirunepe',
|
'America/Eirunepe',
|
||||||
'America/El_Salvador',
|
'America/El_Salvador',
|
||||||
'America/Ensenada',
|
'America/Ensenada',
|
||||||
|
'America/Fort_Nelson',
|
||||||
'America/Fort_Wayne',
|
'America/Fort_Wayne',
|
||||||
'America/Fortaleza',
|
'America/Fortaleza',
|
||||||
'America/Glace_Bay',
|
'America/Glace_Bay',
|
||||||
|
@ -731,6 +735,7 @@ all_timezones = \
|
||||||
'Asia/Bahrain',
|
'Asia/Bahrain',
|
||||||
'Asia/Baku',
|
'Asia/Baku',
|
||||||
'Asia/Bangkok',
|
'Asia/Bangkok',
|
||||||
|
'Asia/Barnaul',
|
||||||
'Asia/Beirut',
|
'Asia/Beirut',
|
||||||
'Asia/Bishkek',
|
'Asia/Bishkek',
|
||||||
'Asia/Brunei',
|
'Asia/Brunei',
|
||||||
|
@ -802,6 +807,7 @@ all_timezones = \
|
||||||
'Asia/Thimbu',
|
'Asia/Thimbu',
|
||||||
'Asia/Thimphu',
|
'Asia/Thimphu',
|
||||||
'Asia/Tokyo',
|
'Asia/Tokyo',
|
||||||
|
'Asia/Tomsk',
|
||||||
'Asia/Ujung_Pandang',
|
'Asia/Ujung_Pandang',
|
||||||
'Asia/Ulaanbaatar',
|
'Asia/Ulaanbaatar',
|
||||||
'Asia/Ulan_Bator',
|
'Asia/Ulan_Bator',
|
||||||
|
@ -907,6 +913,7 @@ all_timezones = \
|
||||||
'Etc/Zulu',
|
'Etc/Zulu',
|
||||||
'Europe/Amsterdam',
|
'Europe/Amsterdam',
|
||||||
'Europe/Andorra',
|
'Europe/Andorra',
|
||||||
|
'Europe/Astrakhan',
|
||||||
'Europe/Athens',
|
'Europe/Athens',
|
||||||
'Europe/Belfast',
|
'Europe/Belfast',
|
||||||
'Europe/Belgrade',
|
'Europe/Belgrade',
|
||||||
|
@ -927,6 +934,7 @@ all_timezones = \
|
||||||
'Europe/Jersey',
|
'Europe/Jersey',
|
||||||
'Europe/Kaliningrad',
|
'Europe/Kaliningrad',
|
||||||
'Europe/Kiev',
|
'Europe/Kiev',
|
||||||
|
'Europe/Kirov',
|
||||||
'Europe/Lisbon',
|
'Europe/Lisbon',
|
||||||
'Europe/Ljubljana',
|
'Europe/Ljubljana',
|
||||||
'Europe/London',
|
'Europe/London',
|
||||||
|
@ -954,6 +962,7 @@ all_timezones = \
|
||||||
'Europe/Tallinn',
|
'Europe/Tallinn',
|
||||||
'Europe/Tirane',
|
'Europe/Tirane',
|
||||||
'Europe/Tiraspol',
|
'Europe/Tiraspol',
|
||||||
|
'Europe/Ulyanovsk',
|
||||||
'Europe/Uzhgorod',
|
'Europe/Uzhgorod',
|
||||||
'Europe/Vaduz',
|
'Europe/Vaduz',
|
||||||
'Europe/Vatican',
|
'Europe/Vatican',
|
||||||
|
@ -1177,6 +1186,7 @@ common_timezones = \
|
||||||
'America/Edmonton',
|
'America/Edmonton',
|
||||||
'America/Eirunepe',
|
'America/Eirunepe',
|
||||||
'America/El_Salvador',
|
'America/El_Salvador',
|
||||||
|
'America/Fort_Nelson',
|
||||||
'America/Fortaleza',
|
'America/Fortaleza',
|
||||||
'America/Glace_Bay',
|
'America/Glace_Bay',
|
||||||
'America/Godthab',
|
'America/Godthab',
|
||||||
|
@ -1224,7 +1234,6 @@ common_timezones = \
|
||||||
'America/Moncton',
|
'America/Moncton',
|
||||||
'America/Monterrey',
|
'America/Monterrey',
|
||||||
'America/Montevideo',
|
'America/Montevideo',
|
||||||
'America/Montreal',
|
|
||||||
'America/Montserrat',
|
'America/Montserrat',
|
||||||
'America/Nassau',
|
'America/Nassau',
|
||||||
'America/New_York',
|
'America/New_York',
|
||||||
|
@ -1249,7 +1258,6 @@ common_timezones = \
|
||||||
'America/Regina',
|
'America/Regina',
|
||||||
'America/Resolute',
|
'America/Resolute',
|
||||||
'America/Rio_Branco',
|
'America/Rio_Branco',
|
||||||
'America/Santa_Isabel',
|
|
||||||
'America/Santarem',
|
'America/Santarem',
|
||||||
'America/Santiago',
|
'America/Santiago',
|
||||||
'America/Santo_Domingo',
|
'America/Santo_Domingo',
|
||||||
|
@ -1297,6 +1305,7 @@ common_timezones = \
|
||||||
'Asia/Bahrain',
|
'Asia/Bahrain',
|
||||||
'Asia/Baku',
|
'Asia/Baku',
|
||||||
'Asia/Bangkok',
|
'Asia/Bangkok',
|
||||||
|
'Asia/Barnaul',
|
||||||
'Asia/Beirut',
|
'Asia/Beirut',
|
||||||
'Asia/Bishkek',
|
'Asia/Bishkek',
|
||||||
'Asia/Brunei',
|
'Asia/Brunei',
|
||||||
|
@ -1356,6 +1365,7 @@ common_timezones = \
|
||||||
'Asia/Tehran',
|
'Asia/Tehran',
|
||||||
'Asia/Thimphu',
|
'Asia/Thimphu',
|
||||||
'Asia/Tokyo',
|
'Asia/Tokyo',
|
||||||
|
'Asia/Tomsk',
|
||||||
'Asia/Ulaanbaatar',
|
'Asia/Ulaanbaatar',
|
||||||
'Asia/Urumqi',
|
'Asia/Urumqi',
|
||||||
'Asia/Ust-Nera',
|
'Asia/Ust-Nera',
|
||||||
|
@ -1394,6 +1404,7 @@ common_timezones = \
|
||||||
'Canada/Pacific',
|
'Canada/Pacific',
|
||||||
'Europe/Amsterdam',
|
'Europe/Amsterdam',
|
||||||
'Europe/Andorra',
|
'Europe/Andorra',
|
||||||
|
'Europe/Astrakhan',
|
||||||
'Europe/Athens',
|
'Europe/Athens',
|
||||||
'Europe/Belgrade',
|
'Europe/Belgrade',
|
||||||
'Europe/Berlin',
|
'Europe/Berlin',
|
||||||
|
@ -1413,6 +1424,7 @@ common_timezones = \
|
||||||
'Europe/Jersey',
|
'Europe/Jersey',
|
||||||
'Europe/Kaliningrad',
|
'Europe/Kaliningrad',
|
||||||
'Europe/Kiev',
|
'Europe/Kiev',
|
||||||
|
'Europe/Kirov',
|
||||||
'Europe/Lisbon',
|
'Europe/Lisbon',
|
||||||
'Europe/Ljubljana',
|
'Europe/Ljubljana',
|
||||||
'Europe/London',
|
'Europe/London',
|
||||||
|
@ -1438,6 +1450,7 @@ common_timezones = \
|
||||||
'Europe/Stockholm',
|
'Europe/Stockholm',
|
||||||
'Europe/Tallinn',
|
'Europe/Tallinn',
|
||||||
'Europe/Tirane',
|
'Europe/Tirane',
|
||||||
|
'Europe/Ulyanovsk',
|
||||||
'Europe/Uzhgorod',
|
'Europe/Uzhgorod',
|
||||||
'Europe/Vaduz',
|
'Europe/Vaduz',
|
||||||
'Europe/Vatican',
|
'Europe/Vatican',
|
||||||
|
|
|
@ -15,13 +15,13 @@ from pytz.tzinfo import memorized_datetime, memorized_timedelta
|
||||||
|
|
||||||
def _byte_string(s):
|
def _byte_string(s):
|
||||||
"""Cast a string or byte string to an ASCII byte string."""
|
"""Cast a string or byte string to an ASCII byte string."""
|
||||||
return s.encode('US-ASCII')
|
return s.encode('ASCII')
|
||||||
|
|
||||||
_NULL = _byte_string('\0')
|
_NULL = _byte_string('\0')
|
||||||
|
|
||||||
def _std_string(s):
|
def _std_string(s):
|
||||||
"""Cast a string or byte string to an ASCII string."""
|
"""Cast a string or byte string to an ASCII string."""
|
||||||
return str(s.decode('US-ASCII'))
|
return str(s.decode('ASCII'))
|
||||||
|
|
||||||
def build_tzinfo(zone, fp):
|
def build_tzinfo(zone, fp):
|
||||||
head_fmt = '>4s c 15x 6l'
|
head_fmt = '>4s c 15x 6l'
|
||||||
|
@ -66,7 +66,7 @@ def build_tzinfo(zone, fp):
|
||||||
i += 3
|
i += 3
|
||||||
|
|
||||||
# Now build the timezone object
|
# Now build the timezone object
|
||||||
if len(transitions) == 0:
|
if len(ttinfo) ==1 or len(transitions) == 0:
|
||||||
ttinfo[0][0], ttinfo[0][2]
|
ttinfo[0][0], ttinfo[0][2]
|
||||||
cls = type(zone, (StaticTzInfo,), dict(
|
cls = type(zone, (StaticTzInfo,), dict(
|
||||||
zone=zone,
|
zone=zone,
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/pytz/zoneinfo/America/Fort_Nelson
Normal file
BIN
lib/pytz/zoneinfo/America/Fort_Nelson
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/pytz/zoneinfo/Asia/Barnaul
Normal file
BIN
lib/pytz/zoneinfo/Asia/Barnaul
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/pytz/zoneinfo/Asia/Tomsk
Normal file
BIN
lib/pytz/zoneinfo/Asia/Tomsk
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue