Source

eyeD3 / src / eyed3 / utils / __init__.py

The branch 'stable' does not exist.
Diff from to

File src/eyed3/utils/__init__.py

 #
 ################################################################################
 from __future__ import print_function
-import os, re
+import os
+import re
 
-import mimetypes, StringIO
+import StringIO
+import mimetypes
 _mime_types = mimetypes.MimeTypes()
 _mime_types.readfp(StringIO.StringIO("application/x-id3 id3 tag"))
 del mimetypes
     import magic as magic_mod
     # Need to handle different versions of magic, as the new
     # APIs are totally different
-    if hasattr(magic_mod, open) and hasattr(magic_mod, load):
+    if hasattr(magic_mod, "open") and hasattr(magic_mod, "load"):
         # old magic
-        _magic = magic_mod.open(magic.MAGIC_SYMLINK | magic.MAGIC_MIME)
+        _magic = magic_mod.open(magic_mod.MAGIC_SYMLINK | magic_mod.MAGIC_MIME)
         _magic.load()
+
         def magic_func(path):
             return _magic.file(path)
     else:
         # new magic
         _magic = magic_mod.Magic(mime=True)
+
         def magic_func(path):
             return _magic.from_file(path)
 except:
         '''Called when there are no more files to handle.'''
         pass
 
+
 def requireUnicode(*args):
     '''Function decorator to enforce unicode argument types.
     ``None`` is a valid argument value, in all cases, regardless of not being
     return "%.2f %s" % (sz, unit)
 
 
-##
-# \brief Format a timedelta object into a string
-# \param td The timedelta to represent.
 def formatTimeDelta(td):
+    '''Format a timedelta object ``td`` into a string. '''
     days = td.days
     hours = td.seconds / 3600
     mins = (td.seconds % 3600) / 60
         else:
             done = True
         del data
-