~kissiel/checkbox/fix-1420352

« back to all changes in this revision

Viewing changes to checkbox-support/checkbox_support/lib/tz.py

  • Committer: Sylvain Pineau
  • Date: 2014-01-07 13:39:38 UTC
  • mto: This revision was merged to the branch mainline in revision 2588.
  • Revision ID: sylvain.pineau@canonical.com-20140107133938-46v5ehofwa9whl1e
checkbox-support: Copy required modules from checkbox-old/checkbox

and their corresponding tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file is part of Checkbox.
 
3
#
 
4
# Copyright 2012 Canonical Ltd.
 
5
#
 
6
# Checkbox is free software: you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License version 3,
 
8
# as published by the Free Software Foundation.
 
9
 
 
10
#
 
11
# Checkbox is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
 
18
#
 
19
__all__ = [
 
20
    "tzutc",
 
21
    ]
 
22
 
 
23
from datetime import (
 
24
    timedelta,
 
25
    tzinfo,
 
26
    )
 
27
 
 
28
 
 
29
ZERO = timedelta(0)
 
30
 
 
31
 
 
32
class _tzutc(tzinfo):
 
33
 
 
34
    def utcoffset(self, dt):
 
35
        return ZERO
 
36
 
 
37
    def dst(self, dt):
 
38
        return ZERO
 
39
 
 
40
    def tzname(self, dt):
 
41
        return "UTC"
 
42
 
 
43
    def __eq__(self, other):
 
44
        return isinstance(other, tzutc)
 
45
 
 
46
    def __ne__(self, other):
 
47
        return not self.__eq__(other)
 
48
 
 
49
    def __repr__(self):
 
50
        return "%s()" % self.__class__.__name__
 
51
 
 
52
    __reduce__ = object.__reduce__
 
53
 
 
54
 
 
55
tzutc = _tzutc()