summaryrefslogtreecommitdiff
path: root/lib/tz.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-10-11 00:10:53 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-10-11 00:11:55 +0100
commit91d2158de7954daccb0a22885021c8416d1d5c6c (patch)
tree0c6d537c377ee095d7d4d451477931d7a310dd11 /lib/tz.py
parent4458c9b4c94e524237fb39c7821b248fc2a85e35 (diff)
downloadpsycopg2-91d2158de7954daccb0a22885021c8416d1d5c6c.tar.gz
Python source cleanup using flake8
Diffstat (limited to 'lib/tz.py')
-rw-r--r--lib/tz.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/tz.py b/lib/tz.py
index 695a925..92a1604 100644
--- a/lib/tz.py
+++ b/lib/tz.py
@@ -2,7 +2,7 @@
This module holds two different tzinfo implementations that can be used as
the 'tzinfo' argument to datetime constructors, directly passed to psycopg
-functions or used to set the .tzinfo_factory attribute in cursors.
+functions or used to set the .tzinfo_factory attribute in cursors.
"""
# psycopg/tz.py - tzinfo implementation
#
@@ -31,6 +31,7 @@ import time
ZERO = datetime.timedelta(0)
+
class FixedOffsetTimezone(datetime.tzinfo):
"""Fixed offset in minutes east from UTC.
@@ -52,7 +53,7 @@ class FixedOffsetTimezone(datetime.tzinfo):
def __init__(self, offset=None, name=None):
if offset is not None:
- self._offset = datetime.timedelta(minutes = offset)
+ self._offset = datetime.timedelta(minutes=offset)
if name is not None:
self._name = name
@@ -85,7 +86,7 @@ class FixedOffsetTimezone(datetime.tzinfo):
else:
seconds = self._offset.seconds + self._offset.days * 86400
hours, seconds = divmod(seconds, 3600)
- minutes = seconds/60
+ minutes = seconds / 60
if minutes:
return "%+03d:%d" % (hours, minutes)
else:
@@ -95,13 +96,14 @@ class FixedOffsetTimezone(datetime.tzinfo):
return ZERO
-STDOFFSET = datetime.timedelta(seconds = -time.timezone)
+STDOFFSET = datetime.timedelta(seconds=-time.timezone)
if time.daylight:
- DSTOFFSET = datetime.timedelta(seconds = -time.altzone)
+ DSTOFFSET = datetime.timedelta(seconds=-time.altzone)
else:
DSTOFFSET = STDOFFSET
DSTDIFF = DSTOFFSET - STDOFFSET
+
class LocalTimezone(datetime.tzinfo):
"""Platform idea of local timezone.