From a82b291dbb3ea0acf9776e0287aa3daae55d0b08 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 16 Jul 2019 15:28:51 +1000 Subject: [PATCH] flake 8 fixes --- tuhigui/drawing.py | 1 + tuhigui/drawingperspective.py | 15 +++++++++------ tuhigui/window.py | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tuhigui/drawing.py b/tuhigui/drawing.py index bedf5f9..3c95fc1 100644 --- a/tuhigui/drawing.py +++ b/tuhigui/drawing.py @@ -17,6 +17,7 @@ import time import gi gi.require_version("Gtk", "3.0") + def relative_date(timestamp): t = datetime.date.fromtimestamp(timestamp) today = datetime.date.today() diff --git a/tuhigui/drawingperspective.py b/tuhigui/drawingperspective.py index 660cb0c..b7a84ac 100644 --- a/tuhigui/drawingperspective.py +++ b/tuhigui/drawingperspective.py @@ -18,12 +18,14 @@ from .svg import JsonSvg import json import time import gi +import logging + gi.require_version("Gtk", "3.0") -import logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger('drawingperspective') + def relative_time(seconds): MIN = 60 H = 60 * MIN @@ -31,15 +33,16 @@ def relative_time(seconds): WEEK = 7 * DAY if seconds < 30: - return 'just now' + return 'just now' if seconds < 5 * MIN: - return 'a few minutes ago' + return 'a few minutes ago' if seconds < H: - return f'{int(seconds/MIN/10) * 10} minutes ago' + return f'{int(seconds/MIN/10) * 10} minutes ago' if seconds < DAY: - return f'{int(seconds/H)} hours ago' + return f'{int(seconds/H)} hours ago' if seconds < 4 * WEEK: - return f'{int(seconds/D)} days ago' + return f'{int(seconds/DAY)} days ago' + return 'a long time ago' diff --git a/tuhigui/window.py b/tuhigui/window.py index d723773..49e7181 100644 --- a/tuhigui/window.py +++ b/tuhigui/window.py @@ -11,7 +11,7 @@ # GNU General Public License for more details. # -from gi.repository import Gtk, Gdk +from gi.repository import Gtk from .setupdialog import SetupDialog from .drawingperspective import DrawingPerspective