MCPcopy
hub / github.com/pallets/flask / FixedOffset

Class FixedOffset

tests/test_json.py:145–163  ·  view source on GitHub ↗

Fixed offset in hours east from UTC. This is a slight adaptation of the ``FixedOffset`` example found in https://docs.python.org/2.7/library/datetime.html.

Source from the content-addressed store, hash-verified

143
144
145class FixedOffset(datetime.tzinfo):
146 """Fixed offset in hours east from UTC.
147
148 This is a slight adaptation of the ``FixedOffset`` example found in
149 https://docs.python.org/2.7/library/datetime.html.
150 """
151
152 def __init__(self, hours, name):
153 self.__offset = datetime.timedelta(hours=hours)
154 self.__name = name
155
156 def utcoffset(self, dt):
157 return self.__offset
158
159 def tzname(self, dt):
160 return self.__name
161
162 def dst(self, dt):
163 return datetime.timedelta()
164
165
166@pytest.mark.parametrize("tz", (("UTC", 0), ("PST", -8), ("KST", 9)))

Callers 1

Calls

no outgoing calls

Tested by 1