diff options
author | Gerhard Weis <gerhard.weis@gmail.com> | 2012-10-30 10:59:53 +1000 |
---|---|---|
committer | Gerhard Weis <gerhard.weis@gmail.com> | 2012-10-30 10:59:53 +1000 |
commit | afece50dc8260f8350a7e2f942886dc2b089bd47 (patch) | |
tree | 7dca64bfb1b76a6babdcafb62728c51483acd5a3 /src/isodate/tzinfo.py | |
parent | f16071ab3f7d16155e4b1a4c58ddb9016bd71dbe (diff) | |
download | isodate-afece50dc8260f8350a7e2f942886dc2b089bd47.tar.gz |
* make FixedOffset unpicklable
Diffstat (limited to 'src/isodate/tzinfo.py')
-rw-r--r-- | src/isodate/tzinfo.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/isodate/tzinfo.py b/src/isodate/tzinfo.py index ed6720f..820c88d 100644 --- a/src/isodate/tzinfo.py +++ b/src/isodate/tzinfo.py @@ -1,5 +1,5 @@ ''' -This module provides some datetime.tzinfo implementations. +This module provides some datetime.tzinfo implementations. All those classes are taken from the Python documentation. ''' @@ -7,14 +7,14 @@ from datetime import timedelta, tzinfo import time ZERO = timedelta(0) -# constant for zero time offset. +# constant for zero time offset. class Utc(tzinfo): '''UTC - + Universal time coordinated time zone. ''' - + def utcoffset(self, dt): ''' Return offset from UTC in minutes east of UTC, which is ZERO for UTC. @@ -39,16 +39,16 @@ UTC = Utc() class FixedOffset(tzinfo): ''' 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. + + Note that FixedOffset(0, 0, "UTC") or FixedOffset() is a different way to + build a UTC tzinfo object. ''' - - def __init__(self, offset_hours, offset_minutes, name): + + def __init__(self, offset_hours=0, offset_minutes=0, name="UTC"): ''' Initialise an instance with time offset and name. The time offset should be positive for time zones east of UTC - and negate for time zones west of UTC. + and negate for time zones west of UTC. ''' self.__offset = timedelta(hours=offset_hours, minutes=offset_minutes) self.__name = name @@ -68,11 +68,11 @@ class FixedOffset(tzinfo): def dst(self, dt): ''' - Return the daylight saving time (DST) adjustment, in minutes east of + Return the daylight saving time (DST) adjustment, in minutes east of UTC. ''' return ZERO - + def __repr__(self): ''' Return nicely formatted repr string. |