flake 8 fixes

This commit is contained in:
Peter Hutterer 2019-07-16 15:28:51 +10:00
parent 096c4e22a2
commit a82b291dbb
3 changed files with 11 additions and 7 deletions

View File

@ -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()

View File

@ -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'

View File

@ -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