Jendrik Seipp committed c9ccb43

add support for python3

  • Participants
  • Parent commits 0d9115f

Comments (0)

Files changed (2)

-* vulture requires Python2.7
+* vulture supports Python 2.6, 2.7 and 3.x
 You can install, upgrade, uninstall with these commands::
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <>.
+from __future__ import print_function
 import ast
 from fnmatch import fnmatchcase
 import os
             relpath = os.path.relpath(item.file)
             path = relpath if not relpath.startswith('..') else item.file
-            print "%s:%d: Unused %s '%s'" % (path, item.lineno, item.typ, item)
+            print("%s:%d: Unused %s '%s'" % (path, item.lineno, item.typ, item))
     def get_unused(self, defined, used):
         return list(sorted(set(defined) - set(used), key=lambda x: x.lower()))
     def log(self, *args):
-        if not self.verbose:
-            return
-        for arg in args:
-            print arg,
-        print
+        if self.verbose:
+            print(*args)
     def print_node(self, node):
         self.log(self._get_lineno(node), ast.dump(node), self._get_line(node))