]> granicus.if.org Git - file/commitdiff
PR/357: flake8 warning cleanups
authorChristos Zoulas <christos@zoulas.com>
Tue, 3 Jun 2014 19:14:46 +0000 (19:14 +0000)
committerChristos Zoulas <christos@zoulas.com>
Tue, 3 Jun 2014 19:14:46 +0000 (19:14 +0000)
python/magic.py

index b893693e311b8e1f683e64f9b2ca537e134d6677..3c7aa100f067d08bb209b5a6c248a4af52eeef09 100644 (file)
@@ -8,10 +8,11 @@ import ctypes
 from ctypes import *
 from ctypes.util import find_library
 
+
 def _init():
     """
     Loads the shared library through ctypes and returns a library
-    L{ctypes.CDLL} instance 
+    L{ctypes.CDLL} instance
     """
     return ctypes.cdll.LoadLibrary(find_library('magic'))
 
@@ -46,6 +47,7 @@ MAGIC_NO_CHECK_ENCODING = NO_CHECK_ENCODING = 2097152
 
 MAGIC_NO_CHECK_BUILTIN = NO_CHECK_BUILTIN = 4173824
 
+
 class magic_set(Structure):
     pass
 magic_set._fields_ = []
@@ -99,6 +101,7 @@ _errno = _libraries['magic'].magic_errno
 _errno.restype = c_int
 _errno.argtypes = [magic_t]
 
+
 class Magic(object):
     def __init__(self, ms):
         self._magic_t = ms
@@ -115,7 +118,7 @@ class Magic(object):
         as a filename or None if an error occurred and the MAGIC_ERROR flag
         is set.  A call to errno() will return the numeric error code.
         """
-        try: # attempt python3 approach first
+        try:  # attempt python3 approach first
             if isinstance(filename, bytes):
                 bi = filename
             else:
@@ -136,7 +139,7 @@ class Magic(object):
         as a buffer or None if an error occurred and the MAGIC_ERROR flag
         is set. A call to errno() will return the numeric error code.
         """
-        try: # attempt python3 approach first
+        try:  # attempt python3 approach firstg
             return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
         except:
             return _buffer(self._magic_t, buf, len(buf))
@@ -146,16 +149,16 @@ class Magic(object):
         Returns a textual explanation of the last error or None
         if there was no error.
         """
-        try: # attempt python3 approach first
+        try:  # attempt python3 approach first
             return str(_error(self._magic_t), 'utf-8')
         except:
             return _error(self._magic_t)
-  
+
     def setflags(self, flags):
         """
-        Set flags on the magic object which determine how magic checking behaves;
-        a bitwise OR of the flags described in libmagic(3), but without the MAGIC_
-        prefix.
+        Set flags on the magic object which determine how magic checking
+        behaves; a bitwise OR of the flags described in libmagic(3), but
+        without the MAGIC_ prefix.
 
         Returns -1 on systems that don't support utime(2) or utimes(2)
         when PRESERVE_ATIME is set.
@@ -164,10 +167,10 @@ class Magic(object):
 
     def load(self, filename=None):
         """
-        Must be called to load entries in the colon separated list of database files
-        passed as argument or the default database file if no argument before
-        any magic queries can be performed.
-        
+        Must be called to load entries in the colon separated list of database
+        files passed as argument or the default database file if no argument
+        before any magic queries can be performed.
+
         Returns 0 on success and -1 on failure.
         """
         return _load(self._magic_t, filename)
@@ -199,7 +202,7 @@ class Magic(object):
         Returns 0 on success and -1 on failure.
         """
         return _list(self._magic_t, dbs)
-    
+
     def errno(self):
         """
         Returns a numeric error code. If return value is 0, an internal
@@ -209,6 +212,7 @@ class Magic(object):
         """
         return _errno(self._magic_t)
 
+
 def open(flags):
     """
     Returns a magic object on success and None on failure.