PK8wwpytz/__init__.py''' datetime.tzinfo timezone definitions generated from the Olson timezone database: ftp://elsie.nci.nih.gov/pub/tz*.tar.gz See the datetime section of the Python Library Reference for information on how to use these modules. ''' # The Olson database has historically been updated about 4 times a year OLSON_VERSION = '2008c' VERSION = OLSON_VERSION #VERSION = OLSON_VERSION + '.2' __version__ = OLSON_VERSION OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling __all__ = [ 'timezone', 'utc', 'country_timezones', 'AmbiguousTimeError', 'UnknownTimeZoneError', 'all_timezones', 'all_timezones_set', 'common_timezones', 'common_timezones_set', ] import sys, datetime, os.path, gettext try: from pkg_resources import resource_stream except ImportError: resource_stream = None from tzinfo import AmbiguousTimeError, unpickler from tzfile import build_tzinfo # Use 2.3 sets module implementation if set builtin is not available try: set except NameError: from sets import Set as set def open_resource(name): """Open a resource from the zoneinfo subdir for reading. Uses the pkg_resources module if available. """ if resource_stream is not None: return resource_stream(__name__, 'zoneinfo/' + name) else: name_parts = name.lstrip('/').split('/') for part in name_parts: if part == os.path.pardir or os.path.sep in part: raise ValueError('Bad path segment: %r' % part) filename = os.path.join(os.path.dirname(__file__), 'zoneinfo', *name_parts) return open(filename, 'rb') # Enable this when we get some translations? # We want an i18n API that is useful to programs using Python's gettext # 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 # of them. # # t = gettext.translation( # 'pytz', os.path.join(os.path.dirname(__file__), 'locales'), # fallback=True # ) # def _(timezone_name): # """Translate a timezone name using the current locale, returning Unicode""" # return t.ugettext(timezone_name) class UnknownTimeZoneError(KeyError): '''Exception raised when pytz is passed an unknown timezone. >>> isinstance(UnknownTimeZoneError(), LookupError) True This class is actually a subclass of KeyError to provide backwards compatibility with code relying on the undocumented behavior of earlier pytz releases. >>> isinstance(UnknownTimeZoneError(), KeyError) True ''' pass _tzinfo_cache = {} def timezone(zone): r''' Return a datetime.tzinfo implementation for the given timezone >>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(u'US/Eastern') is eastern True >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc) >>> loc_dt = utc_dt.astimezone(eastern) >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' >>> loc_dt.strftime(fmt) '2002-10-27 01:00:00 EST (-0500)' >>> (loc_dt - timedelta(minutes=10)).strftime(fmt) '2002-10-27 00:50:00 EST (-0500)' >>> eastern.normalize(loc_dt - timedelta(minutes=10)).strftime(fmt) '2002-10-27 01:50:00 EDT (-0400)' >>> (loc_dt + timedelta(minutes=10)).strftime(fmt) '2002-10-27 01:10:00 EST (-0500)' Raises UnknownTimeZoneError if passed an unknown zone. >>> timezone('Asia/Shangri-La') Traceback (most recent call last): ... UnknownTimeZoneError: 'Asia/Shangri-La' >>> timezone(u'\N{TRADE MARK SIGN}') Traceback (most recent call last): ... UnknownTimeZoneError: u'\u2122' ''' if zone.upper() == 'UTC': return utc try: zone = zone.encode('US-ASCII') except UnicodeEncodeError: # All valid timezones are ASCII raise UnknownTimeZoneError(zone) zone = _unmunge_zone(zone) if zone not in _tzinfo_cache: if zone in all_timezones_set: _tzinfo_cache[zone] = build_tzinfo(zone, open_resource(zone)) else: raise UnknownTimeZoneError(zone) return _tzinfo_cache[zone] def _unmunge_zone(zone): """Undo the time zone name munging done by older versions of pytz.""" return zone.replace('_plus_', '+').replace('_minus_', '-') ZERO = datetime.timedelta(0) HOUR = datetime.timedelta(hours=1) class UTC(datetime.tzinfo): """UTC Identical to the reference UTC implementation given in Python docs except that it unpickles using the single module global instance defined beneath this class declaration. Also contains extra attributes and methods to match other pytz tzinfo instances. """ zone = "UTC" def utcoffset(self, dt): return ZERO def tzname(self, dt): return "UTC" def dst(self, dt): return ZERO def __reduce__(self): return _UTC, () def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError, 'Not naive datetime (tzinfo is already set)' return dt.replace(tzinfo=self) def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime''' if dt.tzinfo is None: raise ValueError, 'Naive time - no tzinfo set' return dt.replace(tzinfo=self) def __repr__(self): return "" def __str__(self): return "UTC" UTC = utc = UTC() # UTC is a singleton def _UTC(): """Factory function for utc unpickling. Makes sure that unpickling a utc instance always returns the same module global. These examples belong in the UTC class above, but it is obscured; or in the README.txt, but we are not depending on Python 2.4 so integrating the README.txt examples with the unit tests is not trivial. >>> import datetime, pickle >>> dt = datetime.datetime(2005, 3, 1, 14, 13, 21, tzinfo=utc) >>> naive = dt.replace(tzinfo=None) >>> p = pickle.dumps(dt, 1) >>> naive_p = pickle.dumps(naive, 1) >>> len(p), len(naive_p), len(p) - len(naive_p) (60, 43, 17) >>> new = pickle.loads(p) >>> new == dt True >>> new is dt False >>> new.tzinfo is dt.tzinfo True >>> utc is UTC is timezone('UTC') True >>> utc is timezone('GMT') False """ return utc _UTC.__safe_for_unpickling__ = True def _p(*args): """Factory function for unpickling pytz tzinfo instances. Just a wrapper around tzinfo.unpickler to save a few bytes in each pickle by shortening the path. """ return unpickler(*args) _p.__safe_for_unpickling__ = True _country_timezones_cache = {} def country_timezones(iso3166_code): """Return a list of timezones used in a particular country. iso3166_code is the two letter code used to identify the country. >>> country_timezones('ch') ['Europe/Zurich'] >>> country_timezones('CH') ['Europe/Zurich'] >>> country_timezones(u'ch') ['Europe/Zurich'] >>> country_timezones('XXX') Traceback (most recent call last): ... KeyError: 'XXX' """ iso3166_code = iso3166_code.upper() if not _country_timezones_cache: zone_tab = open_resource('zone.tab') for line in zone_tab: if line.startswith('#'): continue code, coordinates, zone = line.split(None, 4)[:3] try: _country_timezones_cache[code].append(zone) except KeyError: _country_timezones_cache[code] = [zone] return _country_timezones_cache[iso3166_code] # Time-zone info based solely on fixed offsets class _FixedOffset(datetime.tzinfo): zone = None # to match the standard pytz API def __init__(self, minutes): if abs(minutes) >= 1440: raise ValueError("absolute offset is too large", minutes) self._minutes = minutes self._offset = datetime.timedelta(minutes=minutes) def utcoffset(self, dt): return self._offset def __reduce__(self): return FixedOffset, (self._minutes, ) def dst(self, dt): return None def tzname(self, dt): return None def __repr__(self): return 'pytz.FixedOffset(%d)' % self._minutes def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError, 'Not naive datetime (tzinfo is already set)' return dt.replace(tzinfo=self) def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime''' if dt.tzinfo is None: raise ValueError, 'Naive time - no tzinfo set' return dt.replace(tzinfo=self) def FixedOffset(offset, _tzinfos = {}): """return a fixed-offset timezone based off a number of minutes. >>> one = FixedOffset(-330) >>> one pytz.FixedOffset(-330) >>> one.utcoffset(datetime.datetime.now()) datetime.timedelta(-1, 66600) >>> two = FixedOffset(1380) >>> two pytz.FixedOffset(1380) >>> two.utcoffset(datetime.datetime.now()) datetime.timedelta(0, 82800) The datetime.timedelta must be between the range of -1 and 1 day, non-inclusive. >>> FixedOffset(1440) Traceback (most recent call last): ... ValueError: ('absolute offset is too large', 1440) >>> FixedOffset(-1440) Traceback (most recent call last): ... ValueError: ('absolute offset is too large', -1440) An offset of 0 is special-cased to return UTC. >>> FixedOffset(0) is UTC True There should always be only one instance of a FixedOffset per timedelta. This should be true for multiple creation calls. >>> FixedOffset(-330) is one True >>> FixedOffset(1380) is two True It should also be true for pickling. >>> import pickle >>> pickle.loads(pickle.dumps(one)) is one True >>> pickle.loads(pickle.dumps(two)) is two True """ if offset == 0: return UTC info = _tzinfos.get(offset) if info is None: # We haven't seen this one before. we need to save it. # Use setdefault to avoid a race condition and make sure we have # only one info = _tzinfos.setdefault(offset, _FixedOffset(offset)) return info FixedOffset.__safe_for_unpickling__ = True def _test(): import doctest, os, sys sys.path.insert(0, os.pardir) import pytz return doctest.testmod(pytz) if __name__ == '__main__': _test() common_timezones = \ ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Knox_IN', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Katmandu', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'Canada/Atlantic', 'Canada/Central', 'Canada/East-Saskatchewan', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GMT', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Pacific-New', 'US/Samoa', 'UTC'] common_timezones_set = set(common_timezones) all_timezones = \ ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Katmandu', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/East-Saskatchewan', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Pacific-New', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu', 'posixrules'] all_timezones_set = set(all_timezones) PK8`pAApytz/reference.py''' Reference tzinfo implementations from the Python docs. Used for testing against as they are only correct for the years 1987 to 2006. Do not use these for real code. ''' from datetime import tzinfo, timedelta, datetime from pytz import utc, UTC, HOUR, ZERO # A class building tzinfo objects for fixed-offset time zones. # Note that FixedOffset(0, "UTC") is a different way to build a # UTC tzinfo object. class FixedOffset(tzinfo): """Fixed offset in minutes east from UTC.""" def __init__(self, offset, name): self.__offset = timedelta(minutes = offset) self.__name = name def utcoffset(self, dt): return self.__offset def tzname(self, dt): return self.__name def dst(self, dt): return ZERO # A class capturing the platform's idea of local time. import time as _time STDOFFSET = timedelta(seconds = -_time.timezone) if _time.daylight: DSTOFFSET = timedelta(seconds = -_time.altzone) else: DSTOFFSET = STDOFFSET DSTDIFF = DSTOFFSET - STDOFFSET class LocalTimezone(tzinfo): def utcoffset(self, dt): if self._isdst(dt): return DSTOFFSET else: return STDOFFSET def dst(self, dt): if self._isdst(dt): return DSTDIFF else: return ZERO def tzname(self, dt): return _time.tzname[self._isdst(dt)] def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) stamp = _time.mktime(tt) tt = _time.localtime(stamp) return tt.tm_isdst > 0 Local = LocalTimezone() # A complete implementation of current DST rules for major US time zones. def first_sunday_on_or_after(dt): days_to_go = 6 - dt.weekday() if days_to_go: dt += timedelta(days_to_go) return dt # In the US, DST starts at 2am (standard time) on the first Sunday in April. DSTSTART = datetime(1, 4, 1, 2) # and ends at 2am (DST time; 1am standard time) on the last Sunday of Oct. # which is the first Sunday on or after Oct 25. DSTEND = datetime(1, 10, 25, 1) class USTimeZone(tzinfo): def __init__(self, hours, reprname, stdname, dstname): self.stdoffset = timedelta(hours=hours) self.reprname = reprname self.stdname = stdname self.dstname = dstname def __repr__(self): return self.reprname def tzname(self, dt): if self.dst(dt): return self.dstname else: return self.stdname def utcoffset(self, dt): return self.stdoffset + self.dst(dt) def dst(self, dt): if dt is None or dt.tzinfo is None: # An exception may be sensible here, in one or both cases. # It depends on how you want to treat them. The default # fromutc() implementation (called by the default astimezone() # implementation) passes a datetime with dt.tzinfo is self. return ZERO assert dt.tzinfo is self # Find first Sunday in April & the last in October. start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) # Can't compare naive to aware objects, so strip the timezone from # dt first. if start <= dt.replace(tzinfo=None) < end: return HOUR else: return ZERO Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") Central = USTimeZone(-6, "Central", "CST", "CDT") Mountain = USTimeZone(-7, "Mountain", "MST", "MDT") Pacific = USTimeZone(-8, "Pacific", "PST", "PDT") PK8awwpytz/tzfile.py#!/usr/bin/env python ''' $Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $ ''' from cStringIO import StringIO from datetime import datetime, timedelta from struct import unpack, calcsize from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo from pytz.tzinfo import memorized_datetime, memorized_timedelta def build_tzinfo(zone, fp): head_fmt = '>4s 16x 6l' head_size = calcsize(head_fmt) (magic,ttisgmtcnt,ttisstdcnt,leapcnt, timecnt,typecnt,charcnt) = unpack(head_fmt, fp.read(head_size)) # Make sure it is a tzinfo(5) file assert magic == 'TZif' # Read out the transition times, localtime indices and ttinfo structures. data_fmt = '>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)ds' % dict( timecnt=timecnt, ttinfo='lBB'*typecnt, charcnt=charcnt) data_size = calcsize(data_fmt) data = unpack(data_fmt, fp.read(data_size)) # make sure we unpacked the right number of values assert len(data) == 2 * timecnt + 3 * typecnt + 1 transitions = [memorized_datetime(trans) for trans in data[:timecnt]] lindexes = list(data[timecnt:2 * timecnt]) ttinfo_raw = data[2 * timecnt:-1] tznames_raw = data[-1] del data # Process ttinfo into separate structs ttinfo = [] tznames = {} i = 0 while i < len(ttinfo_raw): # have we looked up this timezone name yet? tzname_offset = ttinfo_raw[i+2] if tzname_offset not in tznames: nul = tznames_raw.find('\0', tzname_offset) if nul < 0: nul = len(tznames_raw) tznames[tzname_offset] = tznames_raw[tzname_offset:nul] ttinfo.append((ttinfo_raw[i], bool(ttinfo_raw[i+1]), tznames[tzname_offset])) i += 3 # Now build the timezone object if len(transitions) == 0: ttinfo[0][0], ttinfo[0][2] cls = type(zone, (StaticTzInfo,), dict( zone=zone, _utcoffset=memorized_timedelta(ttinfo[0][0]), _tzname=ttinfo[0][2])) else: # Early dates use the first standard time ttinfo i = 0 while ttinfo[i][1]: i += 1 if ttinfo[i] == ttinfo[lindexes[0]]: transitions[0] = datetime.min else: transitions.insert(0, datetime.min) lindexes.insert(0, i) # calculate transition info transition_info = [] for i in range(len(transitions)): inf = ttinfo[lindexes[i]] utcoffset = inf[0] if not inf[1]: dst = 0 else: for j in range(i-1, -1, -1): prev_inf = ttinfo[lindexes[j]] if not prev_inf[1]: break dst = inf[0] - prev_inf[0] # dst offset tzname = inf[2] # Round utcoffset and dst to the nearest minute or the # datetime library will complain. Conversions to these timezones # might be up to plus or minus 30 seconds out, but it is # the best we can do. utcoffset = int((utcoffset + 30) / 60) * 60 dst = int((dst + 30) / 60) * 60 transition_info.append(memorized_ttinfo(utcoffset, dst, tzname)) cls = type(zone, (DstTzInfo,), dict( zone=zone, _utc_transition_times=transitions, _transition_info=transition_info)) return cls() if __name__ == '__main__': import os.path from pprint import pprint base = os.path.join(os.path.dirname(__file__), 'zoneinfo') tz = build_tzinfo('Australia/Melbourne', open(os.path.join(base,'Australia','Melbourne'), 'rb')) tz = build_tzinfo('US/Eastern', open(os.path.join(base,'US','Eastern'), 'rb')) pprint(tz._utc_transition_times) #print tz.asPython(4) #print tz.transitions_mapping PK8?Զz3z3pytz/tzinfo.py'''Base classes and helpers for building zone specific tzinfo classes''' from datetime import datetime, timedelta, tzinfo from bisect import bisect_right from sets import Set import pytz __all__ = [] _timedelta_cache = {} def memorized_timedelta(seconds): '''Create only one instance of each distinct timedelta''' try: return _timedelta_cache[seconds] except KeyError: delta = timedelta(seconds=seconds) _timedelta_cache[seconds] = delta return delta _epoch = datetime.utcfromtimestamp(0) _datetime_cache = {0: _epoch} def memorized_datetime(seconds): '''Create only one instance of each distinct datetime''' try: return _datetime_cache[seconds] except KeyError: # NB. We can't just do datetime.utcfromtimestamp(seconds) as this # fails with negative values under Windows (Bug #90096) dt = _epoch + timedelta(seconds=seconds) _datetime_cache[seconds] = dt return dt _ttinfo_cache = {} def memorized_ttinfo(*args): '''Create only one instance of each distinct tuple''' try: return _ttinfo_cache[args] except KeyError: ttinfo = ( memorized_timedelta(args[0]), memorized_timedelta(args[1]), args[2] ) _ttinfo_cache[args] = ttinfo return ttinfo _notime = memorized_timedelta(0) def _to_seconds(td): '''Convert a timedelta to seconds''' return td.seconds + td.days * 24 * 60 * 60 class BaseTzInfo(tzinfo): # Overridden in subclass _utcoffset = None _tzname = None zone = None def __str__(self): return self.zone class StaticTzInfo(BaseTzInfo): '''A timezone that has a constant offset from UTC These timezones are rare, as most regions have changed their offset from UTC at some point in their history ''' def fromutc(self, dt): '''See datetime.tzinfo.fromutc''' return (dt + self._utcoffset).replace(tzinfo=self) def utcoffset(self,dt): '''See datetime.tzinfo.utcoffset''' return self._utcoffset def dst(self,dt): '''See datetime.tzinfo.dst''' return _notime def tzname(self,dt): '''See datetime.tzinfo.tzname''' return self._tzname def localize(self, dt, is_dst=False): '''Convert naive time to local time''' if dt.tzinfo is not None: raise ValueError, 'Not naive datetime (tzinfo is already set)' return dt.replace(tzinfo=self) def normalize(self, dt, is_dst=False): '''Correct the timezone information on the given datetime''' if dt.tzinfo is None: raise ValueError, 'Naive time - no tzinfo set' return dt.replace(tzinfo=self) def __repr__(self): return '' % (self.zone,) def __reduce__(self): # Special pickle to zone remains a singleton and to cope with # database changes. return pytz._p, (self.zone,) class DstTzInfo(BaseTzInfo): '''A timezone that has a variable offset from UTC The offset might change if daylight savings time comes into effect, or at a point in history when the region decides to change their timezone definition. ''' # Overridden in subclass _utc_transition_times = None # Sorted list of DST transition times in UTC _transition_info = None # [(utcoffset, dstoffset, tzname)] corresponding # to _utc_transition_times entries zone = None # Set in __init__ _tzinfos = None _dst = None # DST offset def __init__(self, _inf=None, _tzinfos=None): if _inf: self._tzinfos = _tzinfos self._utcoffset, self._dst, self._tzname = _inf else: _tzinfos = {} self._tzinfos = _tzinfos self._utcoffset, self._dst, self._tzname = self._transition_info[0] _tzinfos[self._transition_info[0]] = self for inf in self._transition_info[1:]: if not _tzinfos.has_key(inf): _tzinfos[inf] = self.__class__(inf, _tzinfos) def fromutc(self, dt): '''See datetime.tzinfo.fromutc''' dt = dt.replace(tzinfo=None) idx = max(0, bisect_right(self._utc_transition_times, dt) - 1) inf = self._transition_info[idx] return (dt + inf[0]).replace(tzinfo=self._tzinfos[inf]) def normalize(self, dt): '''Correct the timezone information on the given datetime If date arithmetic crosses DST boundaries, the tzinfo is not magically adjusted. This method normalizes the tzinfo to the correct one. To test, first we need to do some setup >>> from pytz import timezone >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' We next create a datetime right on an end-of-DST transition point, the instant when the wallclocks are wound back one hour. >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc) >>> loc_dt = utc_dt.astimezone(eastern) >>> loc_dt.strftime(fmt) '2002-10-27 01:00:00 EST (-0500)' Now, if we subtract a few minutes from it, note that the timezone information has not changed. >>> before = loc_dt - timedelta(minutes=10) >>> before.strftime(fmt) '2002-10-27 00:50:00 EST (-0500)' But we can fix that by calling the normalize method >>> before = eastern.normalize(before) >>> before.strftime(fmt) '2002-10-27 01:50:00 EDT (-0400)' ''' if dt.tzinfo is None: raise ValueError, 'Naive time - no tzinfo set' # Convert dt in localtime to UTC offset = dt.tzinfo._utcoffset dt = dt.replace(tzinfo=None) dt = dt - offset # convert it back, and return it return self.fromutc(dt) def localize(self, dt, is_dst=False): '''Convert naive time to local time. This method should be used to construct localtimes, rather than passing a tzinfo argument to a datetime constructor. is_dst is used to determine the correct timezone in the ambigous period at the end of daylight savings time. >>> from pytz import timezone >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' >>> amdam = timezone('Europe/Amsterdam') >>> dt = datetime(2004, 10, 31, 2, 0, 0) >>> loc_dt1 = amdam.localize(dt, is_dst=True) >>> loc_dt2 = amdam.localize(dt, is_dst=False) >>> loc_dt1.strftime(fmt) '2004-10-31 02:00:00 CEST (+0200)' >>> loc_dt2.strftime(fmt) '2004-10-31 02:00:00 CET (+0100)' >>> str(loc_dt2 - loc_dt1) '1:00:00' Use is_dst=None to raise an AmbiguousTimeError for ambiguous times at the end of daylight savings >>> try: ... loc_dt1 = amdam.localize(dt, is_dst=None) ... except AmbiguousTimeError: ... print 'Oops' Oops >>> loc_dt1 = amdam.localize(dt, is_dst=None) Traceback (most recent call last): [...] AmbiguousTimeError: 2004-10-31 02:00:00 is_dst defaults to False >>> amdam.localize(dt) == amdam.localize(dt, False) True ''' if dt.tzinfo is not None: raise ValueError, 'Not naive datetime (tzinfo is already set)' # Find the possibly correct timezones. We probably just have one, # but we might end up with two if we are in the end-of-DST # transition period. Or possibly more in some particularly confused # location... possible_loc_dt = Set() for tzinfo in self._tzinfos.values(): loc_dt = tzinfo.normalize(dt.replace(tzinfo=tzinfo)) if loc_dt.replace(tzinfo=None) == dt: possible_loc_dt.add(loc_dt) if len(possible_loc_dt) == 1: return possible_loc_dt.pop() # If told to be strict, raise an exception since we have an # ambiguous case if is_dst is None: raise AmbiguousTimeError(dt) # Filter out the possiblilities that don't match the requested # is_dst filtered_possible_loc_dt = [ p for p in possible_loc_dt if bool(p.tzinfo._dst) == is_dst ] # Hopefully we only have one possibility left. Return it. if len(filtered_possible_loc_dt) == 1: return filtered_possible_loc_dt[0] if len(filtered_possible_loc_dt) == 0: filtered_possible_loc_dt = list(possible_loc_dt) # If we get this far, we have in a wierd timezone transition # where the clocks have been wound back but is_dst is the same # in both (eg. Europe/Warsaw 1915 when they switched to CET). # At this point, we just have to guess unless we allow more # hints to be passed in (such as the UTC offset or abbreviation), # but that is just getting silly. # # Choose the earliest (by UTC) applicable timezone. def mycmp(a,b): return cmp( a.replace(tzinfo=None) - a.tzinfo._utcoffset, b.replace(tzinfo=None) - b.tzinfo._utcoffset, ) filtered_possible_loc_dt.sort(mycmp) return filtered_possible_loc_dt[0] def utcoffset(self, dt): '''See datetime.tzinfo.utcoffset''' return self._utcoffset def dst(self, dt): '''See datetime.tzinfo.dst''' return self._dst def tzname(self, dt): '''See datetime.tzinfo.tzname''' return self._tzname def __repr__(self): if self._dst: dst = 'DST' else: dst = 'STD' if self._utcoffset > _notime: return '' % ( self.zone, self._tzname, self._utcoffset, dst ) else: return '' % ( self.zone, self._tzname, self._utcoffset, dst ) def __reduce__(self): # Special pickle to zone remains a singleton and to cope with # database changes. return pytz._p, ( self.zone, _to_seconds(self._utcoffset), _to_seconds(self._dst), self._tzname ) class AmbiguousTimeError(Exception): '''Exception raised when attempting to create an ambiguous wallclock time. At the end of a DST transition period, a particular wallclock time will occur twice (once before the clocks are set back, once after). Both possibilities may be correct, unless further information is supplied. See DstTzInfo.normalize() for more info ''' def unpickler(zone, utcoffset=None, dstoffset=None, tzname=None): """Factory function for unpickling pytz tzinfo instances. This is shared for both StaticTzInfo and DstTzInfo instances, because database changes could cause a zones implementation to switch between these two base classes and we can't break pickles on a pytz version upgrade. """ # Raises a KeyError if zone no longer exists, which should never happen # and would be a bug. tz = pytz.timezone(zone) # A StaticTzInfo - just return it if utcoffset is None: return tz # This pickle was created from a DstTzInfo. We need to # determine which of the list of tzinfo instances for this zone # to use in order to restore the state of any datetime instances using # it correctly. utcoffset = memorized_timedelta(utcoffset) dstoffset = memorized_timedelta(dstoffset) try: return tz._tzinfos[(utcoffset, dstoffset, tzname)] except KeyError: # The particular state requested in this timezone no longer exists. # This indicates a corrupt pickle, or the timezone database has been # corrected violently enough to make this particular # (utcoffset,dstoffset) no longer exist in the zone, or the # abbreviation has been changed. pass # See if we can find an entry differing only by tzname. Abbreviations # get changed from the initial guess by the database maintainers to # match reality when this information is discovered. for localized_tz in tz._tzinfos.values(): if (localized_tz._utcoffset == utcoffset and localized_tz._dst == dstoffset): return localized_tz # This (utcoffset, dstoffset) information has been removed from the # zone. Add it back. This might occur when the database maintainers have # corrected incorrect information. datetime instances using this # incorrect information will continue to do so, exactly as they were # before being pickled. This is purely an overly paranoid safety net - I # doubt this will ever been needed in real life. inf = (utcoffset, dstoffset, tzname) tz._tzinfos[inf] = tz.__class__(inf, tz._tzinfos) return tz._tzinfos[inf] PK`8C?o?opytz/__init__.pyc; "qHc-@s dZdZeZeZeZdddddddd d g Zd kZd kZd kZ d k Z yd k l Z Wne j o eZ nXd klZlZdklZyeWn ej odklZnXdZdefdYZhZdZdZeidZeiddZ deifdYZ!e!Z!Z"dZ#e$e#_%dZ&e$e&_%hZ'dZ(deifdYZ)hdZ*e$e*_%dZ+e,d jo e+nd!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddgZ-ee-Z.d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZddddddddddddd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]ddd^d_d`dadbdcdddedfdgdhddddddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)didjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddddddd*d+dd,d-d.d/d0d1d2dddddddddddd3d4d5d6d7d8d9d:d;dddd<d=d>d?d@dddddddddddddddddddddddddddddddddddddddddAdBdCdDdEdFdGdddddddddddddddHdIdJdKdLg-Z/ee/Z0d S(Ms datetime.tzinfo timezone definitions generated from the Olson timezone database: ftp://elsie.nci.nih.gov/pub/tz*.tar.gz See the datetime section of the Python Library Reference for information on how to use these modules. s2008cstimezonesutcscountry_timezonessAmbiguousTimeErrorsUnknownTimeZoneErrors all_timezonessall_timezones_setscommon_timezonesscommon_timezones_setN(sresource_stream(sAmbiguousTimeErrors unpickler(s build_tzinfo(sSetcCsttj ottd|Sn|idid}xH|D]@}|ti i jpti i |jot d|qAqAWti i ti itd|}t|dSdS(skOpen a resource from the zoneinfo subdir for reading. Uses the pkg_resources module if available. s zoneinfo/s/sBad path segment: %rszoneinfosrbN(sresource_streamsNones__name__snameslstripssplits name_partsspartsosspathspardirsseps ValueErrorsjoinsdirnames__file__sfilenamesopen(snamesfilenamesparts name_parts((s+build/bdist.linux-i686/egg/pytz/__init__.pys open_resource+s & cBstZdZRS(sfException raised when pytz is passed an unknown timezone. >>> isinstance(UnknownTimeZoneError(), LookupError) True This class is actually a subclass of KeyError to provide backwards compatibility with code relying on the undocumented behavior of earlier pytz releases. >>> isinstance(UnknownTimeZoneError(), KeyError) True (s__name__s __module__s__doc__(((s+build/bdist.linux-i686/egg/pytz/__init__.pysUnknownTimeZoneErrorKs cCs|idjotSny|id}Wntj ot|nXt|}|tjo:|tjot |t |t|>> from datetime import datetime, timedelta >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> eastern.zone 'US/Eastern' >>> timezone(u'US/Eastern') is eastern True >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc) >>> loc_dt = utc_dt.astimezone(eastern) >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' >>> loc_dt.strftime(fmt) '2002-10-27 01:00:00 EST (-0500)' >>> (loc_dt - timedelta(minutes=10)).strftime(fmt) '2002-10-27 00:50:00 EST (-0500)' >>> eastern.normalize(loc_dt - timedelta(minutes=10)).strftime(fmt) '2002-10-27 01:50:00 EDT (-0400)' >>> (loc_dt + timedelta(minutes=10)).strftime(fmt) '2002-10-27 01:10:00 EST (-0500)' Raises UnknownTimeZoneError if passed an unknown zone. >>> timezone('Asia/Shangri-La') Traceback (most recent call last): ... UnknownTimeZoneError: 'Asia/Shangri-La' >>> timezone(u'\N{TRADE MARK SIGN}') Traceback (most recent call last): ... UnknownTimeZoneError: u'\u2122' sUTCsUS-ASCIIN( szonesuppersutcsencodesUnicodeEncodeErrorsUnknownTimeZoneErrors _unmunge_zones _tzinfo_cachesall_timezones_sets build_tzinfos open_resource(szone((s+build/bdist.linux-i686/egg/pytz/__init__.pystimezone]s!   cCs |iddiddSdS(s?Undo the time zone name munging done by older versions of pytz.s_plus_s+s_minus_s-N(szonesreplace(szone((s+build/bdist.linux-i686/egg/pytz/__init__.pys _unmunge_zonesishoursisUTCcBsbtZdZdZdZdZdZdZedZ edZ dZ d Z RS( sUTC Identical to the reference UTC implementation given in Python docs except that it unpickles using the single module global instance defined beneath this class declaration. Also contains extra attributes and methods to match other pytz tzinfo instances. sUTCcCstSdS(N(sZERO(sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pys utcoffsetscCsdSdS(NsUTC((sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pystznamescCstSdS(N(sZERO(sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pysdstscCstffSdS(N(s_UTC(sself((s+build/bdist.linux-i686/egg/pytz/__init__.pys __reduce__scCs1|itj o tdn|id|SdS(s Convert naive time to local times*Not naive datetime (tzinfo is already set)stzinfoN(sdtstzinfosNones ValueErrorsreplacesself(sselfsdtsis_dst((s+build/bdist.linux-i686/egg/pytz/__init__.pyslocalizes cCs1|itjo tdn|id|SdS(s6Correct the timezone information on the given datetimesNaive time - no tzinfo setstzinfoN(sdtstzinfosNones ValueErrorsreplacesself(sselfsdtsis_dst((s+build/bdist.linux-i686/egg/pytz/__init__.pys normalizes cCsdSdS(Ns((sself((s+build/bdist.linux-i686/egg/pytz/__init__.pys__repr__scCsdSdS(NsUTC((sself((s+build/bdist.linux-i686/egg/pytz/__init__.pys__str__s( s__name__s __module__s__doc__szones utcoffsetstznamesdsts __reduce__sFalseslocalizes normalizes__repr__s__str__(((s+build/bdist.linux-i686/egg/pytz/__init__.pysUTCs        cCstSdS(sWFactory function for utc unpickling. Makes sure that unpickling a utc instance always returns the same module global. These examples belong in the UTC class above, but it is obscured; or in the README.txt, but we are not depending on Python 2.4 so integrating the README.txt examples with the unit tests is not trivial. >>> import datetime, pickle >>> dt = datetime.datetime(2005, 3, 1, 14, 13, 21, tzinfo=utc) >>> naive = dt.replace(tzinfo=None) >>> p = pickle.dumps(dt, 1) >>> naive_p = pickle.dumps(naive, 1) >>> len(p), len(naive_p), len(p) - len(naive_p) (60, 43, 17) >>> new = pickle.loads(p) >>> new == dt True >>> new is dt False >>> new.tzinfo is dt.tzinfo True >>> utc is UTC is timezone('UTC') True >>> utc is timezone('GMT') False N(sutc(((s+build/bdist.linux-i686/egg/pytz/__init__.pys_UTCscGst|SdS(sFactory function for unpickling pytz tzinfo instances. Just a wrapper around tzinfo.unpickler to save a few bytes in each pickle by shortening the path. N(s unpicklersargs(sargs((s+build/bdist.linux-i686/egg/pytz/__init__.pys_pscCs|i}t otd}x|D]t}|idoq'n|itdd \}}}yt|i |Wq't j o|gt|>> country_timezones('ch') ['Europe/Zurich'] >>> country_timezones('CH') ['Europe/Zurich'] >>> country_timezones(u'ch') ['Europe/Zurich'] >>> country_timezones('XXX') Traceback (most recent call last): ... KeyError: 'XXX' szone.tabs#iiN(s iso3166_codesuppers_country_timezones_caches open_resourceszone_tabslines startswithssplitsNonescodes coordinatesszonesappendsKeyError(s iso3166_codescodeszones coordinatesslineszone_tab((s+build/bdist.linux-i686/egg/pytz/__init__.pyscountry_timezoness  s _FixedOffsetcBs\tZeZdZdZdZdZdZdZ e dZ e dZ RS( NcCsHt|djotd|n||_tid||_dS(Nisabsolute offset is too largesminutes(sabssminutess ValueErrorsselfs_minutessdatetimes timedeltas_offset(sselfsminutes((s+build/bdist.linux-i686/egg/pytz/__init__.pys__init__s cCs |iSdS(N(sselfs_offset(sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pys utcoffsetscCst|iffSdS(N(s FixedOffsetsselfs_minutes(sself((s+build/bdist.linux-i686/egg/pytz/__init__.pys __reduce__"scCstSdS(N(sNone(sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pysdst%scCstSdS(N(sNone(sselfsdt((s+build/bdist.linux-i686/egg/pytz/__init__.pystzname(scCsd|iSdS(Nspytz.FixedOffset(%d)(sselfs_minutes(sself((s+build/bdist.linux-i686/egg/pytz/__init__.pys__repr__+scCs1|itj o tdn|id|SdS(s Convert naive time to local times*Not naive datetime (tzinfo is already set)stzinfoN(sdtstzinfosNones ValueErrorsreplacesself(sselfsdtsis_dst((s+build/bdist.linux-i686/egg/pytz/__init__.pyslocalize.s cCs1|itjo tdn|id|SdS(s6Correct the timezone information on the given datetimesNaive time - no tzinfo setstzinfoN(sdtstzinfosNones ValueErrorsreplacesself(sselfsdtsis_dst((s+build/bdist.linux-i686/egg/pytz/__init__.pys normalize4s ( s__name__s __module__sNoneszones__init__s utcoffsets __reduce__sdststznames__repr__sFalseslocalizes normalize(((s+build/bdist.linux-i686/egg/pytz/__init__.pys _FixedOffsets       cCsU|djotSn|i|}|tjo|i|t|}n|SdS(s6return a fixed-offset timezone based off a number of minutes. >>> one = FixedOffset(-330) >>> one pytz.FixedOffset(-330) >>> one.utcoffset(datetime.datetime.now()) datetime.timedelta(-1, 66600) >>> two = FixedOffset(1380) >>> two pytz.FixedOffset(1380) >>> two.utcoffset(datetime.datetime.now()) datetime.timedelta(0, 82800) The datetime.timedelta must be between the range of -1 and 1 day, non-inclusive. >>> FixedOffset(1440) Traceback (most recent call last): ... ValueError: ('absolute offset is too large', 1440) >>> FixedOffset(-1440) Traceback (most recent call last): ... ValueError: ('absolute offset is too large', -1440) An offset of 0 is special-cased to return UTC. >>> FixedOffset(0) is UTC True There should always be only one instance of a FixedOffset per timedelta. This should be true for multiple creation calls. >>> FixedOffset(-330) is one True >>> FixedOffset(1380) is two True It should also be true for pickling. >>> import pickle >>> pickle.loads(pickle.dumps(one)) is one True >>> pickle.loads(pickle.dumps(two)) is two True iN(soffsetsUTCs_tzinfossgetsinfosNones setdefaults _FixedOffset(soffsets_tzinfossinfo((s+build/bdist.linux-i686/egg/pytz/__init__.pys FixedOffset;s0  cCsKdk}dk}dk}|iid|idk}|i|SdS(Ni(sdoctestsosssysspathsinsertspardirspytzstestmod(ssysspytzsossdoctest((s+build/bdist.linux-i686/egg/pytz/__init__.pys_test|s s__main__sAfrica/Abidjans Africa/AccrasAfrica/Addis_AbabasAfrica/Algierss Africa/Asmaras Africa/Asmeras Africa/Bamakos Africa/Banguis Africa/Banjuls Africa/BissausAfrica/BlantyresAfrica/BrazzavillesAfrica/Bujumburas Africa/CairosAfrica/Casablancas Africa/CeutasAfrica/Conakrys Africa/DakarsAfrica/Dar_es_SalaamsAfrica/Djiboutis Africa/DoualasAfrica/El_AaiunsAfrica/FreetownsAfrica/Gaborones Africa/HararesAfrica/JohannesburgsAfrica/KampalasAfrica/Khartoums Africa/KigalisAfrica/Kinshasas Africa/LagossAfrica/Librevilles Africa/Lomes Africa/LuandasAfrica/Lubumbashis Africa/Lusakas Africa/Malabos Africa/Maputos Africa/MaserusAfrica/MbabanesAfrica/MogadishusAfrica/MonroviasAfrica/NairobisAfrica/Ndjamenas Africa/NiameysAfrica/NouakchottsAfrica/OuagadougousAfrica/Porto-NovosAfrica/Sao_TomesAfrica/TimbuktusAfrica/Tripolis Africa/TunissAfrica/Windhoeks America/AdaksAmerica/AnchoragesAmerica/AnguillasAmerica/AntiguasAmerica/Araguainas America/ArubasAmerica/AsuncionsAmerica/Atikokans America/Atkas America/BahiasAmerica/Barbadoss America/BelemsAmerica/BelizesAmerica/Blanc-SablonsAmerica/Boa_VistasAmerica/Bogotas America/BoisesAmerica/Buenos_AiressAmerica/Cambridge_BaysAmerica/Campo_GrandesAmerica/CancunsAmerica/CaracassAmerica/CatamarcasAmerica/CayennesAmerica/CaymansAmerica/ChicagosAmerica/ChihuahuasAmerica/Coral_HarboursAmerica/CordobasAmerica/Costa_RicasAmerica/CuiabasAmerica/CuracaosAmerica/DanmarkshavnsAmerica/DawsonsAmerica/Dawson_CreeksAmerica/DenversAmerica/DetroitsAmerica/DominicasAmerica/EdmontonsAmerica/EirunepesAmerica/El_SalvadorsAmerica/EnsenadasAmerica/Fort_WaynesAmerica/FortalezasAmerica/Glace_BaysAmerica/GodthabsAmerica/Goose_BaysAmerica/Grand_TurksAmerica/GrenadasAmerica/GuadeloupesAmerica/GuatemalasAmerica/GuayaquilsAmerica/GuyanasAmerica/HalifaxsAmerica/HavanasAmerica/HermosillosAmerica/IndianapolissAmerica/InuviksAmerica/IqaluitsAmerica/Jamaicas America/JujuysAmerica/JuneausAmerica/Knox_INsAmerica/La_Pazs America/LimasAmerica/Los_AngelessAmerica/LouisvillesAmerica/MaceiosAmerica/ManaguasAmerica/ManaussAmerica/MarigotsAmerica/MartiniquesAmerica/MazatlansAmerica/MendozasAmerica/MenomineesAmerica/MeridasAmerica/Mexico_CitysAmerica/MiquelonsAmerica/MonctonsAmerica/MonterreysAmerica/MontevideosAmerica/MontrealsAmerica/MontserratsAmerica/NassausAmerica/New_YorksAmerica/Nipigons America/NomesAmerica/NoronhasAmerica/PanamasAmerica/PangnirtungsAmerica/ParamaribosAmerica/PhoenixsAmerica/Port-au-PrincesAmerica/Port_of_SpainsAmerica/Porto_AcresAmerica/Porto_VelhosAmerica/Puerto_RicosAmerica/Rainy_RiversAmerica/Rankin_InletsAmerica/RecifesAmerica/ReginasAmerica/ResolutesAmerica/Rio_BrancosAmerica/RosariosAmerica/SantiagosAmerica/Santo_DomingosAmerica/Sao_PaulosAmerica/ScoresbysundsAmerica/ShiprocksAmerica/St_BarthelemysAmerica/St_JohnssAmerica/St_KittssAmerica/St_LuciasAmerica/St_ThomassAmerica/St_VincentsAmerica/Swift_CurrentsAmerica/Tegucigalpas America/ThulesAmerica/Thunder_BaysAmerica/TijuanasAmerica/TorontosAmerica/TortolasAmerica/VancouversAmerica/VirginsAmerica/WhitehorsesAmerica/WinnipegsAmerica/YakutatsAmerica/YellowknifesAntarctica/CaseysAntarctica/DavissAntarctica/DumontDUrvillesAntarctica/MawsonsAntarctica/McMurdosAntarctica/PalmersAntarctica/RotherasAntarctica/South_PolesAntarctica/SyowasAntarctica/VostoksArctic/Longyearbyens Asia/Adens Asia/Almatys Asia/Ammans Asia/Anadyrs Asia/Aqtaus Asia/Aqtobes Asia/AshgabatsAsia/Ashkhabads Asia/Baghdads Asia/Bahrains Asia/Bakus Asia/Bangkoks Asia/Beiruts Asia/Bishkeks Asia/Bruneis Asia/CalcuttasAsia/ChoibalsansAsia/ChongqingsAsia/Chungkings Asia/Colombos Asia/Daccas Asia/Damascuss Asia/Dhakas Asia/Dilis Asia/Dubais Asia/Dushanbes Asia/Gazas Asia/HarbinsAsia/Ho_Chi_MinhsAsia/Hong_Kongs Asia/Hovds Asia/Irkutsks Asia/Istanbuls Asia/Jakartas Asia/JayapurasAsia/Jerusalems Asia/KabulsAsia/Kamchatkas Asia/Karachis Asia/Kashgars Asia/Katmandus Asia/KolkatasAsia/KrasnoyarsksAsia/Kuala_Lumpurs Asia/Kuchings Asia/Kuwaits Asia/Macaos Asia/Macaus Asia/Magadans Asia/Makassars Asia/Manilas Asia/Muscats Asia/NicosiasAsia/Novosibirsks Asia/Omsks Asia/OralsAsia/Phnom_PenhsAsia/PontianaksAsia/Pyongyangs Asia/QatarsAsia/Qyzylordas Asia/Rangoons Asia/Riyadhs Asia/Saigons Asia/SakhalinsAsia/Samarkands Asia/Seouls Asia/ShanghaisAsia/Singapores Asia/Taipeis Asia/Tashkents Asia/Tbilisis Asia/Tehrans Asia/Tel_Avivs Asia/Thimbus Asia/Thimphus Asia/TokyosAsia/Ujung_PandangsAsia/UlaanbaatarsAsia/Ulan_Bators Asia/UrumqisAsia/VientianesAsia/Vladivostoks Asia/YakutsksAsia/Yekaterinburgs Asia/YerevansAtlantic/AzoressAtlantic/BermudasAtlantic/CanarysAtlantic/Cape_VerdesAtlantic/FaeroesAtlantic/FaroesAtlantic/Jan_MayensAtlantic/MadeirasAtlantic/ReykjaviksAtlantic/South_GeorgiasAtlantic/St_HelenasAtlantic/Stanleys Australia/ACTsAustralia/AdelaidesAustralia/BrisbanesAustralia/Broken_HillsAustralia/CanberrasAustralia/CurriesAustralia/DarwinsAustralia/EuclasAustralia/Hobarts Australia/LHIsAustralia/LindemansAustralia/Lord_HowesAustralia/Melbournes Australia/NSWsAustralia/NorthsAustralia/PerthsAustralia/QueenslandsAustralia/SouthsAustralia/SydneysAustralia/TasmaniasAustralia/VictoriasAustralia/WestsAustralia/Yancowinnas Brazil/AcresBrazil/DeNoronhas Brazil/Easts Brazil/WestsCanada/AtlanticsCanada/CentralsCanada/East-SaskatchewansCanada/EasternsCanada/MountainsCanada/NewfoundlandsCanada/PacificsCanada/Saskatchewans Canada/YukonsChile/ContinentalsChile/EasterIslandsEurope/AmsterdamsEurope/Andorras Europe/AthenssEurope/BelfastsEurope/Belgrades Europe/BerlinsEurope/BratislavasEurope/BrusselssEurope/BucharestsEurope/BudapestsEurope/ChisinausEurope/Copenhagens Europe/DublinsEurope/GibraltarsEurope/GuernseysEurope/HelsinkisEurope/Isle_of_MansEurope/Istanbuls Europe/JerseysEurope/Kaliningrads Europe/Kievs Europe/LisbonsEurope/Ljubljanas Europe/LondonsEurope/Luxembourgs Europe/Madrids Europe/MaltasEurope/Mariehamns Europe/Minsks Europe/Monacos Europe/MoscowsEurope/Nicosias Europe/Oslos Europe/ParissEurope/Podgoricas Europe/Pragues Europe/Rigas Europe/Romes Europe/SamarasEurope/San_MarinosEurope/SarajevosEurope/Simferopols Europe/Skopjes Europe/SofiasEurope/StockholmsEurope/Tallinns Europe/TiranesEurope/TiraspolsEurope/Uzhgorods Europe/VaduzsEurope/Vaticans Europe/ViennasEurope/VilniussEurope/Volgograds Europe/Warsaws Europe/ZagrebsEurope/Zaporozhyes Europe/ZurichsGMTsIndian/Antananarivos Indian/ChagossIndian/Christmass Indian/Cocoss Indian/ComorosIndian/Kerguelens Indian/MahesIndian/MaldivessIndian/MauritiussIndian/MayottesIndian/ReunionsMexico/BajaNortesMexico/BajaSursMexico/Generals Pacific/ApiasPacific/AucklandsPacific/ChathamsPacific/Easters Pacific/EfatesPacific/EnderburysPacific/Fakaofos Pacific/FijisPacific/FunafutisPacific/GalapagossPacific/GambiersPacific/Guadalcanals Pacific/GuamsPacific/HonolulusPacific/JohnstonsPacific/KiritimatisPacific/KosraesPacific/KwajaleinsPacific/MajurosPacific/MarquesassPacific/Midways Pacific/Naurus Pacific/NiuesPacific/NorfolksPacific/NoumeasPacific/Pago_Pagos Pacific/PalausPacific/PitcairnsPacific/PonapesPacific/Port_MoresbysPacific/RarotongasPacific/Saipans Pacific/SamoasPacific/TahitisPacific/TarawasPacific/Tongatapus Pacific/Truks Pacific/WakesPacific/Walliss Pacific/Yaps US/Alaskas US/Aleutians US/Arizonas US/CentralsUS/East-Indianas US/Easterns US/HawaiisUS/Indiana-Starkes US/Michigans US/Mountains US/PacificsUS/Pacific-NewsUS/SamoasAmerica/Argentina/Buenos_AiressAmerica/Argentina/Catamarcas America/Argentina/ComodRivadaviasAmerica/Argentina/CordobasAmerica/Argentina/JujuysAmerica/Argentina/La_RiojasAmerica/Argentina/MendozasAmerica/Argentina/Rio_GallegossAmerica/Argentina/San_JuansAmerica/Argentina/San_LuissAmerica/Argentina/TucumansAmerica/Argentina/UshuaiasAmerica/Indiana/IndianapolissAmerica/Indiana/KnoxsAmerica/Indiana/MarengosAmerica/Indiana/PetersburgsAmerica/Indiana/Tell_CitysAmerica/Indiana/VevaysAmerica/Indiana/VincennessAmerica/Indiana/WinamacsAmerica/Kentucky/LouisvillesAmerica/Kentucky/MonticellosAmerica/North_Dakota/CentersAmerica/North_Dakota/New_SalemsCETsCST6CDTsCubasEETsESTsEST5EDTsEgyptsEiresEtc/GMTs Etc/GMT+0s Etc/GMT+1s Etc/GMT+10s Etc/GMT+11s Etc/GMT+12s Etc/GMT+2s Etc/GMT+3s Etc/GMT+4s Etc/GMT+5s Etc/GMT+6s Etc/GMT+7s Etc/GMT+8s Etc/GMT+9s Etc/GMT-0s Etc/GMT-1s Etc/GMT-10s Etc/GMT-11s Etc/GMT-12s Etc/GMT-13s Etc/GMT-14s Etc/GMT-2s Etc/GMT-3s Etc/GMT-4s Etc/GMT-5s Etc/GMT-6s Etc/GMT-7s Etc/GMT-8s Etc/GMT-9sEtc/GMT0s Etc/GreenwichsEtc/UCTsEtc/UTCs Etc/UniversalsEtc/ZulusGBsGB-EiresGMT+0sGMT-0sGMT0s GreenwichsHSTsHongkongsIcelandsIransIsraelsJamaicasJapans KwajaleinsLibyasMETsMSTsMST7MDTsNZsNZ-CHATsNavajosPRCsPST8PDTsPolandsPortugalsROCsROKs SingaporesTurkeysUCTs UniversalsW-SUsWETsZulus posixrules(1s__doc__s OLSON_VERSIONsVERSIONs __version__s OLSEN_VERSIONs__all__ssyssdatetimesos.pathsossgettexts pkg_resourcessresource_streams ImportErrorsNonestzinfosAmbiguousTimeErrors unpicklerstzfiles build_tzinfossets NameErrorssetssSets open_resourcesKeyErrorsUnknownTimeZoneErrors _tzinfo_cachestimezones _unmunge_zones timedeltasZEROsHOURsUTCsutcs_UTCsTrues__safe_for_unpickling__s_ps_country_timezones_cachescountry_timezoness _FixedOffsets FixedOffsets_tests__name__scommon_timezonesscommon_timezones_sets all_timezonessall_timezones_set("scountry_timezonesssets _FixedOffsets all_timezoness_testsdatetimes build_tzinfosall_timezones_sets OLSON_VERSIONstimezones _unmunge_zonescommon_timezones_setsUnknownTimeZoneErrors__all__s unpicklersresource_streamsgettexts_ps_country_timezones_cachescommon_timezoness __version__s_UTCsUTCs _tzinfo_cachessyssZEROsVERSIONs FixedOffsets OLSEN_VERSIONsutcsHOURsAmbiguousTimeErrors open_resourcesos((s+build/bdist.linux-i686/egg/pytz/__init__.pys? sn!$    5 +      & >    ` 0PK`8ͤ||pytz/reference.pyc; "qHc@sadZdklZlZlZdklZlZlZlZdefdYZ dk Z ede i Z e ioede i Zne Zee ZdefdYZeZd Zed d d d Zed d dd ZdefdYZeddddZeddddZeddddZedddd ZdS(!s Reference tzinfo implementations from the Python docs. Used for testing against as they are only correct for the years 1987 to 2006. Do not use these for real code. (stzinfos timedeltasdatetime(sutcsUTCsHOURsZEROs FixedOffsetcBs2tZdZdZdZdZdZRS(s&Fixed offset in minutes east from UTC.cCstd||_||_dS(Nsminutes(s timedeltasoffsetsselfs_FixedOffset__offsetsnames_FixedOffset__name(sselfsoffsetsname((s,build/bdist.linux-i686/egg/pytz/reference.pys__init__scCs |iSdS(N(sselfs_FixedOffset__offset(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pys utcoffsetscCs |iSdS(N(sselfs_FixedOffset__name(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pystznamescCstSdS(N(sZERO(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pysdsts(s__name__s __module__s__doc__s__init__s utcoffsetstznamesdst(((s,build/bdist.linux-i686/egg/pytz/reference.pys FixedOffsets    Nssecondss LocalTimezonecBs,tZdZdZdZdZRS(NcCs |i|otSntSdS(N(sselfs_isdstsdts DSTOFFSETs STDOFFSET(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pys utcoffset,scCs |i|otSntSdS(N(sselfs_isdstsdtsDSTDIFFsZERO(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pysdst2scCsti|i|SdS(N(s_timestznamesselfs_isdstsdt(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pystzname8sc Csh|i|i|i|i|i|i|iddf }t i |}t i |}|i djSdS(Nii(sdtsyearsmonthsdayshoursminutessecondsweekdaystts_timesmktimesstamps localtimestm_isdst(sselfsdtsstampstt((s,build/bdist.linux-i686/egg/pytz/reference.pys_isdst;s9(s__name__s __module__s utcoffsetsdststznames_isdst(((s,build/bdist.linux-i686/egg/pytz/reference.pys LocalTimezone*s   cCs3d|i}|o|t|7}n|SdS(Ni(sdtsweekdays days_to_gos timedelta(sdts days_to_go((s,build/bdist.linux-i686/egg/pytz/reference.pysfirst_sunday_on_or_afterGsiiii is USTimeZonecBs5tZdZdZdZdZdZRS(NcCs1td||_||_||_||_dS(Nshours(s timedeltashourssselfs stdoffsetsreprnamesstdnamesdstname(sselfshourssreprnamesstdnamesdstname((s,build/bdist.linux-i686/egg/pytz/reference.pys__init__Us  cCs |iSdS(N(sselfsreprname(sself((s,build/bdist.linux-i686/egg/pytz/reference.pys__repr__[scCs&|i|o |iSn|iSdS(N(sselfsdstsdtsdstnamesstdname(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pystzname^s cCs|i|i|SdS(N(sselfs stdoffsetsdstsdt(sselfsdt((s,build/bdist.linux-i686/egg/pytz/reference.pys utcoffsetdscCs|tjp |itjotSn|i|jptttid|i }tt id|i }||idtjo |jnot SntSdS(Nsyearstzinfo(sdtsNonestzinfosZEROsselfsAssertionErrorsfirst_sunday_on_or_aftersDSTSTARTsreplacesyearsstartsDSTENDsendsHOUR(sselfsdtsendsstart((s,build/bdist.linux-i686/egg/pytz/reference.pysdstgs*(s__name__s __module__s__init__s__repr__stznames utcoffsetsdst(((s,build/bdist.linux-i686/egg/pytz/reference.pys USTimeZoneSs     isEasternsESTsEDTisCentralsCSTsCDTisMountainsMSTsMDTisPacificsPSTsPDT(s__doc__sdatetimestzinfos timedeltaspytzsutcsUTCsHOURsZEROs FixedOffsetstimes_timestimezones STDOFFSETsdaylightsaltzones DSTOFFSETsDSTDIFFs LocalTimezonesLocalsfirst_sunday_on_or_aftersDSTSTARTsDSTENDs USTimeZonesEasternsCentralsMountainsPacific(sMountains USTimeZonesdatetimes DSTOFFSETsfirst_sunday_on_or_aftersLocalsHOURsEasternsDSTSTARTsDSTDIFFstzinfos LocalTimezonesDSTENDsUTCsCentrals timedeltas STDOFFSETsZEROs FixedOffsetsutcsPacifics_time((s,build/bdist.linux-i686/egg/pytz/reference.pys?s&     (PK`8&/jjpytz/tzfile.pyc; "qHc@sdZdklZdklZlZdklZlZdkl Z l Z l Z dkl Z l Z dZedjodkZd klZeiieiied Zed eeiied d dZedeeiiedddZeeindS(s7 $Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $ (sStringIO(sdatetimes timedelta(sunpackscalcsize(s StaticTzInfos DstTzInfosmemorized_ttinfo(smemorized_datetimesmemorized_timedeltac! Csd}t|}t||i|\}} } }}}}|djpt dtd|dd|d|} t| } t| |i| }t|d|d |d jpt gi}|| D]}|t|q~}t||d|!}|d|d !}|d }~g}h}d }x|t|jo||d}||joD|i d |}|d jot|}n|||!||4s 16x 6lsTZifs2>%(timecnt)dl %(timecnt)dB %(ttinfo)s %(charcnt)dsstimecntsttinfoslBBscharcntiiiiisszones _utcoffsets_tznameii<s_utc_transition_timess_transition_info(6shead_fmtscalcsizes head_sizesunpacksfpsreadsmagics ttisgmtcnts ttisstdcntsleapcntstimecntstypecntscharcntsAssertionErrorsdictsdata_fmts data_sizesdataslensappends_[1]stranssmemorized_datetimes transitionsslistslindexess ttinfo_raws tznames_rawsttinfostznamessis tzname_offsetsfindsnulsboolstypeszones StaticTzInfosmemorized_timedeltasclssdatetimesminsinsertstransition_infosrangesinfs utcoffsetsdstsjsprev_infstznamesintsmemorized_ttinfos DstTzInfo(!szonesfpslindexessnulsinfs transitionssprev_infsleapcntscharcntstransition_infos ttisstdcntsdata_fmts data_sizes ttisgmtcnts tznames_raws utcoffsets ttinfo_rawsdatas tzname_offsetstypecnts head_sizesmagicsisjstznamess_[1]stimecntstznameshead_fmtsclssttinfostranssdst((s)build/bdist.linux-i686/egg/pytz/tzfile.pys build_tzinfosx -# *1   ,      s__main__N(spprintszoneinfosAustralia/Melbournes Australias Melbournesrbs US/EasternsUSsEastern(s__doc__s cStringIOsStringIOsdatetimes timedeltasstructsunpackscalcsizes pytz.tzinfos StaticTzInfos DstTzInfosmemorized_ttinfosmemorized_datetimesmemorized_timedeltas build_tzinfos__name__sos.pathsosspprintspathsjoinsdirnames__file__sbasesopenstzs_utc_transition_times(s StaticTzInfos timedeltasStringIOsosspprints DstTzInfosdatetimes build_tzinfosbasescalcsizesmemorized_datetimesmemorized_ttinfosmemorized_timedeltasunpackstz((s)build/bdist.linux-i686/egg/pytz/tzfile.pys?s  Y   !$$PK`8T77pytz/tzinfo.pyc; "qHc@sdZdklZlZlZdklZdklZdkZgZ hZ dZ ei dZ hde (sselfszone(sself((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys__repr__cscCsti|iffSdS(N(spytzs_psselfszone(sself((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys __reduce__fs( s__name__s __module__s__doc__sfromutcs utcoffsetsdststznamesFalseslocalizes normalizes__repr__s __reduce__(((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys StaticTzInfoAs        s DstTzInfocBstZdZeZeZeZeZeZeedZ dZ dZ e dZ dZdZdZdZd ZRS( sA timezone that has a variable offset from UTC The offset might change if daylight savings time comes into effect, or at a point in history when the region decides to change their timezone definition. cCs|o%||_|\|_|_|_nh}||_|id\|_|_|_|||id>> from pytz import timezone >>> utc = timezone('UTC') >>> eastern = timezone('US/Eastern') >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' We next create a datetime right on an end-of-DST transition point, the instant when the wallclocks are wound back one hour. >>> utc_dt = datetime(2002, 10, 27, 6, 0, 0, tzinfo=utc) >>> loc_dt = utc_dt.astimezone(eastern) >>> loc_dt.strftime(fmt) '2002-10-27 01:00:00 EST (-0500)' Now, if we subtract a few minutes from it, note that the timezone information has not changed. >>> before = loc_dt - timedelta(minutes=10) >>> before.strftime(fmt) '2002-10-27 00:50:00 EST (-0500)' But we can fix that by calling the normalize method >>> before = eastern.normalize(before) >>> before.strftime(fmt) '2002-10-27 01:50:00 EDT (-0400)' sNaive time - no tzinfo setstzinfoN( sdtstzinfosNones ValueErrors _utcoffsetsoffsetsreplacesselfsfromutc(sselfsdtsoffset((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys normalizes#   c Csk|itj o tdnt}x\|iiD]K}|i |i d|} | i dt|jo|i | q6q6Wt |djo|iSn|tjot|ngi}|D]-}t|ii|jo||qq~}t |djo |dSnt |djot|}nd}|i||dSdS(sZConvert naive time to local time. This method should be used to construct localtimes, rather than passing a tzinfo argument to a datetime constructor. is_dst is used to determine the correct timezone in the ambigous period at the end of daylight savings time. >>> from pytz import timezone >>> fmt = '%Y-%m-%d %H:%M:%S %Z (%z)' >>> amdam = timezone('Europe/Amsterdam') >>> dt = datetime(2004, 10, 31, 2, 0, 0) >>> loc_dt1 = amdam.localize(dt, is_dst=True) >>> loc_dt2 = amdam.localize(dt, is_dst=False) >>> loc_dt1.strftime(fmt) '2004-10-31 02:00:00 CEST (+0200)' >>> loc_dt2.strftime(fmt) '2004-10-31 02:00:00 CET (+0100)' >>> str(loc_dt2 - loc_dt1) '1:00:00' Use is_dst=None to raise an AmbiguousTimeError for ambiguous times at the end of daylight savings >>> try: ... loc_dt1 = amdam.localize(dt, is_dst=None) ... except AmbiguousTimeError: ... print 'Oops' Oops >>> loc_dt1 = amdam.localize(dt, is_dst=None) Traceback (most recent call last): [...] AmbiguousTimeError: 2004-10-31 02:00:00 is_dst defaults to False >>> amdam.localize(dt) == amdam.localize(dt, False) True s*Not naive datetime (tzinfo is already set)stzinfoiicCs=t|idt|ii|idt|iiSdS(Nstzinfo(scmpsasreplacesNonestzinfos _utcoffsetsb(sasb((s)build/bdist.linux-i686/egg/pytz/tzinfo.pysmycmpsN(sdtstzinfosNones ValueErrorsSetspossible_loc_dtsselfs_tzinfossvaluess normalizesreplacesloc_dtsaddslenspopsis_dstsAmbiguousTimeErrorsappends_[1]spsbools_dstsfiltered_possible_loc_dtslistsmycmpssort( sselfsdtsis_dstspossible_loc_dtsmycmpsfiltered_possible_loc_dts_[1]spstzinfosloc_dt((s)build/bdist.linux-i686/egg/pytz/tzinfo.pyslocalizes*)   D   cCs |iSdS(sSee datetime.tzinfo.utcoffsetN(sselfs _utcoffset(sselfsdt((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys utcoffsetscCs |iSdS(sSee datetime.tzinfo.dstN(sselfs_dst(sselfsdt((s)build/bdist.linux-i686/egg/pytz/tzinfo.pysdst!scCs |iSdS(sSee datetime.tzinfo.tznameN(sselfs_tzname(sselfsdt((s)build/bdist.linux-i686/egg/pytz/tzinfo.pystzname%scCsl|io d}nd}|itjo!d|i|i|i|fSnd|i|i|i|fSdS(NsDSTsSTDss(sselfs_dstsdsts _utcoffsets_notimeszones_tzname(sselfsdst((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys__repr__)s   !cCs5ti|it|it|i|iffSdS(N(spytzs_psselfszones _to_secondss _utcoffsets_dsts_tzname(sself((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys __reduce__7s(s__name__s __module__s__doc__sNones_utc_transition_timess_transition_infoszones_tzinfoss_dsts__init__sfromutcs normalizesFalseslocalizes utcoffsetsdststznames__repr__s __reduce__(((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys DstTzInfols   . ]    sAmbiguousTimeErrorcBstZdZRS(sXException raised when attempting to create an ambiguous wallclock time. At the end of a DST transition period, a particular wallclock time will occur twice (once before the clocks are set back, once after). Both possibilities may be correct, unless further information is supplied. See DstTzInfo.normalize() for more info (s__name__s __module__s__doc__(((s)build/bdist.linux-i686/egg/pytz/tzinfo.pysAmbiguousTimeErrorBs cCsti|}|tjo|Snt|}t|}y|i|||fSWnt j onXx?|ii D].}|i |jo |i|jo|SqzqzW|||f}|i||i|i|<|i|SdS(s)Factory function for unpickling pytz tzinfo instances. This is shared for both StaticTzInfo and DstTzInfo instances, because database changes could cause a zones implementation to switch between these two base classes and we can't break pickles on a pytz version upgrade. N(spytzstimezoneszonestzs utcoffsetsNonesmemorized_timedeltas dstoffsets_tzinfosstznamesKeyErrorsvaluess localized_tzs _utcoffsets_dstsinfs __class__(szones utcoffsets dstoffsetstznamestzs localized_tzsinf((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys unpicklerMs"     (s__doc__sdatetimes timedeltastzinfosbisects bisect_rightssetssSetspytzs__all__s_timedelta_cachesmemorized_timedeltasutcfromtimestamps_epochs_datetime_cachesmemorized_datetimes _ttinfo_cachesmemorized_ttinfos_notimes _to_secondss BaseTzInfos StaticTzInfos DstTzInfos ExceptionsAmbiguousTimeErrorsNones unpickler(s DstTzInfosdatetimes _ttinfo_cachesmemorized_timedeltas__all__s unpicklers_epochsmemorized_datetimestzinfos timedeltas _to_secondss_timedelta_cachespytzs bisect_rights_datetime_cachesmemorized_ttinfos BaseTzInfosSets StaticTzInfos_notimesAmbiguousTimeError((s)build/bdist.linux-i686/egg/pytz/tzinfo.pys?s&        + PK8YQQpytz/zoneinfo/WETTZif2z cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~yWESTWETTZif2z cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~yWESTWET WET0WEST,M3.5.0/1,M10.5.0 PK8*ljEpytz/zoneinfo/CETTZif2 `ٮ qKͩ΢Cϒ4Ђ% cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y  CESTCETTZif2 `ٮ qKͩ΢Cϒ4Ђ% cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y  CESTCET CET-1CEST,M3.5.0,M10.5.0/3 PK8 a4pytz/zoneinfo/METTZif2 `ٮ qKͩ΢Cϒ4Ђ% cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y  MESTMETTZif2 `ٮ qKͩ΢Cϒ4Ђ% cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y  MESTMET MET-1MEST,M3.5.0,M10.5.0/3 PK8;=TTpytz/zoneinfo/EETTZif2z cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y*0 EESTEETTZif2z cEt6d'TMD3#ܐ͐㯐ӠÑ| lr!\c"LT#A?@f#A9BFCdD%ECFɐG#GIIJKL̿MNOnnPQWRleS7lTLGUNV,)V0XFXY(Z[ \]^_`_a}b?c]̐de=fgg藐hriyjTk[lqm=nSohp5qQ<rfs1tEuv/vxxyِz{λ|}~y*0 EESTEET EET-2EEST,M3.5.0/3,M10.5.0/4 PK8m vvpytz/zoneinfo/ESTTZif2ESTTZif2EST EST5 PK8/Uvvpytz/zoneinfo/MSTTZif2MSTTZif2MST MST7 PK8xwwpytz/zoneinfo/HSTTZif2s`HSTTZif2s`HST HST10 PK87pytz/zoneinfo/EST5EDTTZif2p`p`ˈp#p`X;:wp``pP`@p0`p ` ` p ٢ gpfeyHiGY*I)9 ) ")` ` p`p`p` v!`"U#j$5%J&'*s'p) U)ޥp*7+p,T`-ip.6`/~Kp0`1gg2r`3GI4R`5'+62`7 889:;۞p?b@opA`BOpCda`D/vpEDC`EG-_GӊI AIlJ#KpL@`M|kpN"`O\MpP`Qp?b@opA`BOpCda`D/vpEDC`EG-_GӊI AIlJ#KpL@`M|kpN"`O\MpP`Qހ?p@oApBOCdopD/EDQpEG-mGәI OI{J1KLNpM|yN0pO\[PpQ<=RupSTUpTV5pVXXYZ[ޘ\]z^d_\`M€aypb-cg[pd eG=pehg'pgJipi,jpkIlmv+noV pq5rostOtv8pvπxpxyhpz{Jp|~u},p~^Wp CDTCSTCWTCPTTZif2,ppˈ#pa gII++ wq pa Pp@0p' p p ٰ uttyViVY8I89)"7pppp܀p v!p"U#j$5%J&'*'р) c)޳*E+,bp-w.Dp/~Y0&p1gv2sp3GX4Rp5':62p7889:;۬<=>ހ?p@oApBOCdopD/EDQpEG-mGәI OI{J1KLNpM|yN0pO\[PpQ<=RupSTUpTV5pVXXYZ[ޘ\]z^d_\`M€aypb-cg[pd eG=pehg'pgJipi,jpkIlmv+noV pq5rostOtv8pvπxpxyhpz{Jp|~u},p~^Wp CDTCSTCWTCPT CST6CDT,M3.2.0,M11.1.0 PK863\pytz/zoneinfo/MST7MDTTZif2:ˉ #pauXW:9wqaP@0ހ5   ࡐ ٿ yeidYGIF9))("E '& ̀ v!"U#j$5%J&'*'ߐ) r)*T+,p-.R/~g041g2s3Gf4R5'H62ڀ7*88 9:;ۻ< =>?@oΐABOCd}D/ED_EG-|GӧI ^IJ@KL\M|N>O\iP Q?@oΐABOCd}D/ED_EG-|GӧI ^IJ@KL\M|N>O\iP Q?@oܠABOCdD/EDmE G-Gӵ I lI JNKLjM|NLO\wP.Q?@oܠABOCdD/EDmE G-Gӵ I lI JNKLjM|NLO\wP.Q0 PK8D%vvpytz/zoneinfo/GMTTZif2GMTTZif2GMT GMT0 PK8uk k pytz/zoneinfo/CubaTZif2 b€ӔPt]@[fQ@;Hʼm$eP̜O P;ӣP`}@=DS;@ũh@wp@`P5@PH@ P{ P j@ iP ن KPhP}@Qf1F[&{;d]F?(\@ >@zSP @ Z5P!o@"CQ#N@$#3%.@&''P()މP*״+kP,-MP.x/~/P0wZ1gK2W<3G-4@YP5P62P6P889:Ƶ;ېP?T@oPED5PEG$PGܩPIPIPJPKLMNOekPQEMRlS%/TLUV,aV.PX~PXPY`PZP[BP\P]$P^mP_P`Va~"b6c^de=exggZhiPrfOPsPtF1Puv/Mvx/xyz{|}~ggHMTCDTCSTTZif2i(b€ӔPt]@[fQ@;Hʼm$eP̜O P;ӣP`}@=DS;@ũh@wp@`P5@PH@ P{ P j@ iP ن KPhP}@Qf1F[&{;d]F?(\@ >@zSP @ Z5P!o@"CQ#N@$#3%.@&''P()މP*״+kP,-MP.x/~/P0wZ1gK2W<3G-4@YP5P62P6P889:Ƶ;ېP?T@oPED5PEG$PGܩPIPIPJPKLMNOekPQEMRlS%/TLUV,aV.PX~PXPY`PZP[BP\P]$P^mP_P`Va~"b6c^de=exggZhi<j݌kYPlƩPm;PnPo_PpmPq>PrfOPsPtF1Puv/Mvx/xyz{|}~gg LMTHMTCDTCST CST5CDT,M3.3.0/0,M10.5.0/1 PK8s[$[$pytz/zoneinfo/EgyptTZif2 ȓ{ˮ`)ͬϏfЩyф`ҊP6c`-P ``mﰳpy%ZYsp;Up6Ep9۾p%gYpIap+C Հ$Ep x < 1pdt(pU\np7OPHp{<pp4g p!a"z\p#D $b'p%%S&^`?sWP@zA\sBq\CEPF1 FjPHHIJK`LvM`NVO`P?PQy`RPSY`SPU9k`UzPW"W\PYiYxZK[Z\-]h<^_H`,`a(bk`cdJ`dPf*`fPh `hPi`jPkӲlpPmnYovp9qsXrgsS:sIu^`?sWP@zA\sBq\CEPF1 FjPHHIJK`LvM`NVO`P?PQy`RPSY`SPU9k`UzPW"W\PYiYxZK[Z\-]h<^_H`,`a(bk`cdJ`dPf*`fPh `hPi`jPkӲlpPmnYovp9qsXrgsS:sIuS`bP5`DP`&P3PcPM,f F/`̎`p~`P``uoPB`UQP$`53Px@PX"18ƽȝ`}`]͠`FPπ`&P`m`|P@O`^P)k@P Mׯ\/ُ>o ܨOޒ`.q`Q`P1`P`淧Pz`藉PږwkPxWMPZ@iz< KZ-:#```P`hP`HP`(PkxPKZP+gv IX+:  q *` P `:Ps`PS`P3`PPPܒtbVBe|8"G eU`!)"E7`"FP$%`$(P&`& P'`(P)*jP+,JP-.3/m01M13-c3r5`5T6b`768D`9|SP:&`;\5P<`=<P>u`?P@_@PB>BDDEFGގHIǫ`JdK`LDaMo`N-~POgQ`P `PQG3`QBPS'`S$PU1UPVW"XYvZ[U\]5^x`_`X``b8`bީPd|`dPe^`fmPg@`h~OPi\j^1Pk>l>Pm n'/oapq@qs su `uv`wPxɧ`yoPz`{OP|k`}/zP~r\PRi>P2KZ-<x`W`@Pz` PZ`P:`P#PiPvXig:II)+l9` L`+` P `P`Pˣ`qPQP:tTet4GV)8F`(`y `cP`BP|`"P\`PEP%˽īrƋTkcɮq`KEˎS`+'n5`DPN`&P-`P `ӳP