py3: Use explicit float or integer division

This commit is contained in:
Stein Magnus Jodal 2014-12-07 20:25:51 +01:00
parent 7124226fc7
commit e35a066d5e
3 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, division, unicode_literals
import datetime
import os
@ -81,7 +81,7 @@ class Scanner(object):
def _collect(self):
"""Polls for messages to collect data."""
start = time.time()
timeout_s = self._timeout_ms / float(1000)
timeout_s = self._timeout_ms / 1000.
tags = {}
while time.time() - start < timeout_s:

View File

@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function, unicode_literals
from __future__ import (
absolute_import, division, print_function, unicode_literals)
import logging
import os
@ -163,6 +164,6 @@ class _Progress(object):
logger.info('Scanned %d of %d files in %ds.',
self.count, self.total, duration)
else:
remainder = duration / self.count * (self.total - self.count)
remainder = duration // self.count * (self.total - self.count)
logger.info('Scanned %d of %d files in %ds, ~%ds left.',
self.count, self.total, duration, remainder)

View File

@ -1,4 +1,4 @@
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import, division, unicode_literals
import glob
import logging
@ -92,7 +92,7 @@ class LocalPlaylistsProvider(backend.PlaylistsProvider):
def _write_m3u_extinf(self, file_handle, track):
title = track.name.encode('latin-1', 'replace')
runtime = track.length / 1000 if track.length else -1
runtime = track.length // 1000 if track.length else -1
file_handle.write('#EXTINF:' + str(runtime) + ',' + title + '\n')
def _save_m3u(self, playlist):