summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart.bishop@canonical.com>2019-04-10 11:58:56 +1000
committerStuart Bishop <stuart.bishop@canonical.com>2019-04-10 11:58:56 +1000
commit589b6e59af9e0d212f9b029389207057d82a98d9 (patch)
treefdc82eccd37c305614339d2e8a1b6bceafe7534f
parent9eceee2ce7571e8c4d80ef8791f6df5ed1b5f190 (diff)
downloadpytz-git-589b6e59af9e0d212f9b029389207057d82a98d9.tar.gz
Bump versions to 2019.1/2019a & lint fixes
-rw-r--r--src/pytz/__init__.py22
-rw-r--r--src/pytz/tests/test_tzinfo.py16
2 files changed, 24 insertions, 14 deletions
diff --git a/src/pytz/__init__.py b/src/pytz/__init__.py
index 36d38c3..5c05066 100644
--- a/src/pytz/__init__.py
+++ b/src/pytz/__init__.py
@@ -16,14 +16,14 @@ from pytz.exceptions import AmbiguousTimeError
from pytz.exceptions import InvalidTimeError
from pytz.exceptions import NonExistentTimeError
from pytz.exceptions import UnknownTimeZoneError
-from pytz.lazy import LazyDict, LazyList, LazySet
+from pytz.lazy import LazyDict, LazyList, LazySet # noqa
from pytz.tzinfo import unpickler, BaseTzInfo
from pytz.tzfile import build_tzinfo
# The IANA (nee Olson) database is updated several times a year.
-OLSON_VERSION = '2018i'
-VERSION = '2018.9' # pip compatible version number.
+OLSON_VERSION = '2019a'
+VERSION = '2019.1' # pip compatible version number.
__version__ = VERSION
OLSEN_VERSION = OLSON_VERSION # Old releases had this misspelling
@@ -171,7 +171,7 @@ def timezone(zone):
zone = _case_insensitive_zone_lookup(_unmunge_zone(zone))
if zone not in _tzinfo_cache:
- if zone in all_timezones_set:
+ if zone in all_timezones_set: # noqa
fp = open_resource(zone)
try:
_tzinfo_cache[zone] = build_tzinfo(zone, fp)
@@ -189,8 +189,8 @@ def _unmunge_zone(zone):
def _case_insensitive_zone_lookup(zone):
- """Get case-insensitively matching timezone, if found, else return zone unchanged"""
- return _all_timezones_lower_to_standard.get(zone.lower()) or zone
+ """case-insensitively matching timezone, else return zone unchanged"""
+ return _all_timezones_lower_to_standard.get(zone.lower()) or zone # noqa
ZERO = datetime.timedelta(0)
@@ -280,6 +280,8 @@ def _UTC():
False
"""
return utc
+
+
_UTC.__safe_for_unpickling__ = True
@@ -290,6 +292,8 @@ def _p(*args):
by shortening the path.
"""
return unpickler(*args)
+
+
_p.__safe_for_unpickling__ = True
@@ -338,7 +342,7 @@ class _CountryTimezoneDict(LazyDict):
if line.startswith('#'):
continue
code, coordinates, zone = line.split(None, 4)[:3]
- if zone not in all_timezones_set:
+ if zone not in all_timezones_set: # noqa
continue
try:
data[code].append(zone)
@@ -348,6 +352,7 @@ class _CountryTimezoneDict(LazyDict):
finally:
zone_tab.close()
+
country_timezones = _CountryTimezoneDict()
@@ -371,6 +376,7 @@ class _CountryNameDict(LazyDict):
finally:
zone_tab.close()
+
country_names = _CountryNameDict()
@@ -482,6 +488,7 @@ def FixedOffset(offset, _tzinfos={}):
return info
+
FixedOffset.__safe_for_unpickling__ = True
@@ -491,5 +498,6 @@ def _test():
import pytz
return doctest.testmod(pytz)
+
if __name__ == '__main__':
_test()
diff --git a/src/pytz/tests/test_tzinfo.py b/src/pytz/tests/test_tzinfo.py
index 6a852cc..e56fef5 100644
--- a/src/pytz/tests/test_tzinfo.py
+++ b/src/pytz/tests/test_tzinfo.py
@@ -20,15 +20,15 @@ if __name__ == '__main__':
# the paths already
sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, os.pardir)))
-import pytz
-from pytz import reference
-from pytz.tzfile import _byte_string
-from pytz.tzinfo import DstTzInfo, StaticTzInfo
+import pytz # noqa
+from pytz import reference # noqa
+from pytz.tzfile import _byte_string # noqa
+from pytz.tzinfo import DstTzInfo, StaticTzInfo # noqa
# I test for expected version to ensure the correct version of pytz is
# actually being tested.
-EXPECTED_VERSION = '2018.9'
-EXPECTED_OLSON_VERSION = '2018i'
+EXPECTED_VERSION = '2019.1'
+EXPECTED_OLSON_VERSION = '2019a'
fmt = '%Y-%m-%d %H:%M:%S %Z%z'
@@ -765,7 +765,9 @@ class ZoneCaseInsensitivityTestCase(unittest.TestCase):
from_passed = pytz.timezone(tz)
self.assertEqual(from_lower,
from_passed,
- "arg '%s' and arg '%s' produce different timezone objects" % (from_lower, from_passed))
+ "arg '%s' and arg '%s' produce different "
+ "timezone objects" % (
+ from_lower, from_passed))
class BaseTzInfoTestCase: