aboutsummaryrefslogtreecommitdiff
path: root/dateutil/relativedelta.py
diff options
context:
space:
mode:
authorPaul Ganssle <paul@ganssle.io>2016-11-06 15:41:23 -0500
committerPaul Ganssle <paul@ganssle.io>2016-11-06 15:41:23 -0500
commitbced9222a9caae04924e43b9ffb2d2cdb2488174 (patch)
treea2cac4e60b025cc580af48f809a815a7e2e0d589 /dateutil/relativedelta.py
parenta66cdfee7cdcd1c9ed71f6a44e1a930a0d36e12e (diff)
downloaddateutil-bced9222a9caae04924e43b9ffb2d2cdb2488174.tar.gz
Moved 'weekday' into a _common.py module.
Diffstat (limited to 'dateutil/relativedelta.py')
-rw-r--r--dateutil/relativedelta.py35
1 files changed, 3 insertions, 32 deletions
diff --git a/dateutil/relativedelta.py b/dateutil/relativedelta.py
index 6c71d2f..7e3bd12 100644
--- a/dateutil/relativedelta.py
+++ b/dateutil/relativedelta.py
@@ -8,41 +8,12 @@ from math import copysign
from six import integer_types
from warnings import warn
-__all__ = ["relativedelta", "MO", "TU", "WE", "TH", "FR", "SA", "SU"]
-
-
-class weekday(object):
- __slots__ = ["weekday", "n"]
-
- def __init__(self, weekday, n=None):
- self.weekday = weekday
- self.n = n
-
- def __call__(self, n):
- if n == self.n:
- return self
- else:
- return self.__class__(self.weekday, n)
-
- def __eq__(self, other):
- try:
- if self.weekday != other.weekday or self.n != other.n:
- return False
- except AttributeError:
- return False
- return True
-
- __hash__ = None
-
- def __repr__(self):
- s = ("MO", "TU", "WE", "TH", "FR", "SA", "SU")[self.weekday]
- if not self.n:
- return s
- else:
- return "%s(%+d)" % (s, self.n)
+from ._common import weekday
MO, TU, WE, TH, FR, SA, SU = weekdays = tuple([weekday(x) for x in range(7)])
+__all__ = ["relativedelta", "MO", "TU", "WE", "TH", "FR", "SA", "SU"]
+
class relativedelta(object):
"""