aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ganssle <pganssle@users.noreply.github.com>2016-11-08 09:16:17 -0500
committerGitHub <noreply@github.com>2016-11-08 09:16:17 -0500
commitce96faee209b6fd62f41c62ae7bfcd39dc6be5c6 (patch)
tree61221f6c24a37c0e21f44a8c4604fbb74b9dad49
parent09ec7657f9748221ba3eb9b0ef19dca99ae71bfe (diff)
parentacf03bf716dcfe3c7c84d4c82b559ca7e52f259b (diff)
downloaddateutil-ce96faee209b6fd62f41c62ae7bfcd39dc6be5c6.tar.gz
Merge pull request #314 from pganssle/expose-zoneinfo-instance
Expose zoneinfo instance and other documentation fixes.
-rw-r--r--dateutil/easter.py6
-rw-r--r--dateutil/zoneinfo/__init__.py19
2 files changed, 19 insertions, 6 deletions
diff --git a/dateutil/easter.py b/dateutil/easter.py
index 8d30c4e..e4def97 100644
--- a/dateutil/easter.py
+++ b/dateutil/easter.py
@@ -33,9 +33,9 @@ def easter(year, method=EASTER_WESTERN):
These methods are represented by the constants:
- EASTER_JULIAN = 1
- EASTER_ORTHODOX = 2
- EASTER_WESTERN = 3
+ * ``EASTER_JULIAN = 1``
+ * ``EASTER_ORTHODOX = 2``
+ * ``EASTER_WESTERN = 3``
The default method is method 3.
diff --git a/dateutil/zoneinfo/__init__.py b/dateutil/zoneinfo/__init__.py
index 099d5a2..7145e05 100644
--- a/dateutil/zoneinfo/__init__.py
+++ b/dateutil/zoneinfo/__init__.py
@@ -13,7 +13,7 @@ from contextlib import closing
from dateutil.tz import tzfile
-__all__ = ["gettz", "gettz_db_metadata", "rebuild"]
+__all__ = ["get_zonefile_instance", "gettz", "gettz_db_metadata", "rebuild"]
ZONEFILENAME = "dateutil-zoneinfo.tar.gz"
METADATA_FN = 'METADATA'
@@ -71,8 +71,21 @@ class ZoneInfoFile(object):
self.zones = dict()
self.metadata = None
- def get(self, name):
- return self.zones.get(name)
+ def get(self, name, default=None):
+ """
+ Wrapper for :func:`ZoneInfoFile.zones.get`. This is a convenience method
+ for retrieving zones from the zone dictionary.
+
+ :param name:
+ The name of the zone to retrieve. (Generally IANA zone names)
+
+ :param default:
+ The value to return in the event of a missing key.
+
+ .. versionadded:: 2.6.0
+
+ """
+ return self.zones.get(name, default)
# The current API has gettz as a module function, although in fact it taps into