Fix imports and general cleanup
[youtube-dl] / youtube_dl / downloader / common.py
index 6e44c88c9f980472c54d25efadb33de7264927f6..8181bca093c227d1f11b1c2d91d61f026749a731 100644 (file)
@@ -5,8 +5,8 @@ import re
 import sys
 import time
 
+from ..compat import compat_str
 from ..utils import (
-    compat_str,
     encodeFilename,
     format_bytes,
     timeconvert,
@@ -160,7 +160,7 @@ class FileDownloader(object):
             return
         speed = float(byte_counter) / elapsed
         if speed > rate_limit:
-            time.sleep(max((byte_counter / rate_limit) - elapsed, 0))
+            time.sleep(max((byte_counter // rate_limit) - elapsed, 0))
 
     def temp_name(self, filename):
         """Returns a temporary filename for the given filename."""