Hello community,

here is the log from the commit of package python-vulture for openSUSE:Factory 
checked in at 2019-02-20 14:10:37
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-vulture (Old)
 and      /work/SRC/openSUSE:Factory/.python-vulture.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-vulture"

Wed Feb 20 14:10:37 2019 rev:5 rq:673195 version:1.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-vulture/python-vulture.changes    
2018-12-24 11:45:58.669208330 +0100
+++ /work/SRC/openSUSE:Factory/.python-vulture.new.28833/python-vulture.changes 
2019-02-20 14:10:39.790952816 +0100
@@ -1,0 +2,9 @@
+Mon Feb 11 05:11:25 UTC 2019 - John Vandenberg <[email protected]>
+
+- Update to v1.0
+  * Add ``--ignore-decorators`
+  * Add whitelist for ``threading`` module
+- Add test dependency pytest > 3.2.3 due to use of CaptureResult.
+- Reduce hack to remove unsuitable hashbangs
+
+-------------------------------------------------------------------

Old:
----
  vulture-0.29.tar.gz

New:
----
  vulture-1.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-vulture.spec ++++++
--- /var/tmp/diff_new_pack.LM52On/_old  2019-02-20 14:10:40.422952606 +0100
+++ /var/tmp/diff_new_pack.LM52On/_new  2019-02-20 14:10:40.426952604 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-vulture
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,24 +18,23 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-vulture
-Version:        0.29
+Version:        1.0
 Release:        0
 Summary:        Python module for finding dead code
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/jendrikseipp/vulture
+URL:            https://github.com/jendrikseipp/vulture
 Source:         
https://files.pythonhosted.org/packages/source/v/vulture/vulture-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
+BuildArch:      noarch
 # SECTION test requirements
+BuildRequires:  %{python_module pytest > 3.2.3}
 BuildRequires:  %{python_module pytest-cov}
-BuildRequires:  %{python_module pytest}
 # /SECTION
-BuildArch:      noarch
-Requires(post):   update-alternatives
-Requires(postun):  update-alternatives
-
 %python_subpackages
 
 %description
@@ -56,10 +55,9 @@
 * sorts unused classes and functions by size with ``--sort-by-size``
 * supports Python 2.6, 2.7 and 3.x
 
-
 %prep
 %setup -q -n vulture-%{version}
-sed -i -e '/^#! \//, 1d' *.py vulture/core.py
+sed -i -e '/^#! \//, 1d' vulture/core.py
 
 %build
 %python_build

++++++ vulture-0.29.tar.gz -> vulture-1.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/NEWS.rst new/vulture-1.0/NEWS.rst
--- old/vulture-0.29/NEWS.rst   2018-07-31 14:15:44.000000000 +0200
+++ new/vulture-1.0/NEWS.rst    2018-10-23 18:27:25.000000000 +0200
@@ -1,9 +1,15 @@
 News
 ====
 
+1.0 (2018-10-23)
+----------------
+* Add ``--ignore-decorators`` flag (thanks @RJ722).
+* Add whitelist for ``threading`` module (thanks @andrewhalle).
+
+
 0.29 (2018-07-31)
 -----------------
-* Add ``--ignore-names`` flag for ignoring names matching the given glob 
patterns.
+* Add ``--ignore-names`` flag for ignoring names matching the given glob 
patterns (thanks @RJ722).
 
 
 0.28 (2018-07-05)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/PKG-INFO new/vulture-1.0/PKG-INFO
--- old/vulture-0.29/PKG-INFO   2018-07-31 14:37:07.000000000 +0200
+++ new/vulture-1.0/PKG-INFO    2018-10-23 18:29:40.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: vulture
-Version: 0.29
+Version: 1.0
 Summary: Find dead code
 Home-page: https://github.com/jendrikseipp/vulture
 Author: Jendrik Seipp
@@ -82,13 +82,17 @@
         **Ignoring names**
         
         You can use ``--ignore-names foo*,ba[rz]`` to let Vulture ignore all 
names
-        starting with ``foo`` and the names ``bar`` and ``baz``.
-        
-        We recommend using whitelists instead of ``--ignore-names`` whenever
-        possible, since whitelists are automatically checked for syntactic
-        correctness when passed to Vulture and sometimes you can even pass
-        them to your Python interpreter and let it check that all whitelisted
-        code actually still exists in your project.
+        starting with ``foo`` and the names ``bar`` and ``baz``. Additionally, 
the
+        ``--ignore-decorators`` option can be used to ignore functions 
decorated
+        with the given decorator. This is helpful for example in Flask 
projects,
+        where you can use ``--ignore-decorators "@app.route"`` to ignore all 
functions
+        with the ``@app.route`` decorator.
+        
+        We recommend using whitelists instead of ``--ignore-names`` or
+        ``--ignore-decorators`` whenever possible, since whitelists are 
automatically
+        checked for syntactic correctness when passed to Vulture and often you 
can
+        even pass them to your Python interpreter and let it check that all
+        whitelisted code actually still exists in your project.
         
         **Marking unused variables**
         
@@ -224,9 +228,15 @@
         News
         ====
         
+        1.0 (2018-10-23)
+        ----------------
+        * Add ``--ignore-decorators`` flag (thanks @RJ722).
+        * Add whitelist for ``threading`` module (thanks @andrewhalle).
+        
+        
         0.29 (2018-07-31)
         -----------------
-        * Add ``--ignore-names`` flag for ignoring names matching the given 
glob patterns.
+        * Add ``--ignore-names`` flag for ignoring names matching the given 
glob patterns (thanks @RJ722).
         
         
         0.28 (2018-07-05)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/README.rst new/vulture-1.0/README.rst
--- old/vulture-0.29/README.rst 2018-07-24 23:07:58.000000000 +0200
+++ new/vulture-1.0/README.rst  2018-07-31 14:52:23.000000000 +0200
@@ -74,13 +74,17 @@
 **Ignoring names**
 
 You can use ``--ignore-names foo*,ba[rz]`` to let Vulture ignore all names
-starting with ``foo`` and the names ``bar`` and ``baz``.
+starting with ``foo`` and the names ``bar`` and ``baz``. Additionally, the
+``--ignore-decorators`` option can be used to ignore functions decorated
+with the given decorator. This is helpful for example in Flask projects,
+where you can use ``--ignore-decorators "@app.route"`` to ignore all functions
+with the ``@app.route`` decorator.
 
-We recommend using whitelists instead of ``--ignore-names`` whenever
-possible, since whitelists are automatically checked for syntactic
-correctness when passed to Vulture and sometimes you can even pass
-them to your Python interpreter and let it check that all whitelisted
-code actually still exists in your project.
+We recommend using whitelists instead of ``--ignore-names`` or
+``--ignore-decorators`` whenever possible, since whitelists are automatically
+checked for syntactic correctness when passed to Vulture and often you can
+even pass them to your Python interpreter and let it check that all
+whitelisted code actually still exists in your project.
 
 **Marking unused variables**
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/TODO.rst new/vulture-1.0/TODO.rst
--- old/vulture-0.29/TODO.rst   2018-07-14 21:24:36.000000000 +0200
+++ new/vulture-1.0/TODO.rst    2018-10-16 23:46:53.000000000 +0200
@@ -1,8 +1,6 @@
 TODOs
 =====
 
-* Add --ignore-names option.
-
 
 Non-TODOs
 =========
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tests/test_ignore.py 
new/vulture-1.0/tests/test_ignore.py
--- old/vulture-0.29/tests/test_ignore.py       1970-01-01 01:00:00.000000000 
+0100
+++ new/vulture-1.0/tests/test_ignore.py        2018-07-31 14:52:23.000000000 
+0200
@@ -0,0 +1,179 @@
+from vulture import core
+
+from . import check, skip_if_not_has_async
+
+
+def check_ignore(code, ignore_names, ignore_decorators, expected):
+    v = core.Vulture(verbose=True, ignore_names=ignore_names,
+                     ignore_decorators=ignore_decorators)
+    v.scan(code)
+    check(v.get_unused_code(), expected)
+
+
+def test_var():
+    code = """\
+fio = 1
+fao = 2
+bar = 2
+ftobar = 3
+baz = 10000
+funny = True
+"""
+    check_ignore(code, ['f?o*', 'ba[rz]'], [], ['funny'])
+
+
+def test_function():
+    code = """\
+def foo_one():
+    pass
+def foo_two():
+    pass
+def foo():
+    pass
+def bar():
+    pass
+"""
+    check_ignore(code, ['foo*'], [], ['bar'])
+
+
+@skip_if_not_has_async
+def test_async_function():
+    code = """\
+async def foobar():
+    pass
+async def bar():
+    pass
+"""
+    check_ignore(code, ['foo*'], [], ['bar'])
+
+
+def test_class():
+    code = """\
+class Foo:
+    def __init__(self):
+        pass
+"""
+    check_ignore(code, ['Foo'], [], [])
+
+
+def test_class_ignore():
+    code = """\
+@bar
+class Foo:
+    pass
+
+class Bar:
+    pass
+"""
+    check_ignore(code, [], [], ['Foo', 'Bar'])
+
+
+def test_property():
+    code = """\
+class Foo:
+    @property
+    def some_property(self, a):
+        return a
+
+    @property
+    @bar
+    def foo_bar(self):
+        return 'bar'
+"""
+    check_ignore(code, ['Foo'], ['@property'], [])
+    check_ignore(code, ['Foo'], [], ['some_property', 'foo_bar'])
+
+
+def test_attribute():
+    code = """\
+class Foo:
+    def __init__(self, attr_foo, attr_bar):
+        self.attr_foo = attr_foo
+        self.attr_bar = attr_bar
+"""
+    check_ignore(code, ['foo', '*_foo'], [], ['Foo', 'attr_bar'])
+
+
+def test_decorated_functions():
+    code = """\
+def decor():
+    return help
+
+class FooBar:
+    def foobar(self):
+        return help
+
+    @property
+    def prop_one(self):
+        pass
+
+f = FooBar()
+
+@decor()
+def bar():
+    pass
+
[email protected]
+def foo():
+    pass
+
+@bar
+@foo
[email protected]()
+def barfoo():
+    pass
+"""
+    check_ignore(code, [], ['@decor', '*@f.foobar'], ['prop_one'])
+    check_ignore(code, [], ['*decor', '@*f.foobar'], ['prop_one'])
+
+
+@skip_if_not_has_async
+def test_decorated_async_functions():
+    code = """\
[email protected]('something')
+@foobar
+async def async_function():
+    pass
+
[email protected]
+async def foo():
+    pass
+"""
+    check_ignore(code, [], ['@app.route', '@a.b'], ['foo'])
+
+
+def test_decorated_property():
+    code = """\
+@bar
+@property
+def foo():
+    pass
+"""
+    check_ignore(code, [], ['@bar'], [])
+    check_ignore(code, [], ['@baz'], ['foo'])
+    check_ignore(code, [], ['@property'], [])
+
+
+def test_decorated_property_reversed():
+    code = """\
+@property
+@bar
+def foo():
+    pass
+"""
+    check_ignore(code, [], ['@bar'], [])
+    check_ignore(code, [], ['@property'], [])
+    check_ignore(code, [], ['@b*r'], [])
+    check_ignore(code, [], ['@barfoo'], ['foo'])
+
+
+def test_decorated_class():
+    code = """\
+@barfoo
[email protected]('foo')
+class Bar:
+    def __init__(self):
+        pass
+"""
+    check_ignore(code, [], [], ['Bar'])
+    check_ignore(code, [], ['@bar*'], [])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tests/test_ignore_names.py 
new/vulture-1.0/tests/test_ignore_names.py
--- old/vulture-0.29/tests/test_ignore_names.py 2018-07-24 23:07:58.000000000 
+0200
+++ new/vulture-1.0/tests/test_ignore_names.py  1970-01-01 01:00:00.000000000 
+0100
@@ -1,59 +0,0 @@
-import pytest
-
-from vulture import core
-
-from . import check
-
-
[email protected]
-def check_ignore():
-    def examine(code, ignore_names, expected):
-        v = core.Vulture(verbose=True, ignore_names=ignore_names)
-        v.scan(code)
-        check(v.get_unused_code(), expected)
-    return examine
-
-
-def test_var(check_ignore):
-    code = """\
-fio = 1
-fao = 2
-bar = 2
-ftobar = 3
-baz = 10000
-funny = True
-"""
-    check_ignore(code, ['f?o*', 'ba[rz]'], ['funny'])
-
-
-def test_function(check_ignore):
-    code = """\
-def foo_one():
-    pass
-def foo_two():
-    pass
-def foo():
-    pass
-def bar():
-    pass
-"""
-    check_ignore(code, ['foo*'], ['bar'])
-
-
-def test_class(check_ignore):
-    code = """\
-class Foo:
-    def __init__(self):
-        pass
-"""
-    check_ignore(code, ['Foo'], [])
-
-
-def test_attribute(check_ignore):
-    code = """\
-class Foo:
-    def __init__(self, attr_foo, attr_bar):
-        self.attr_foo = attr_foo
-        self.attr_bar = attr_bar
-"""
-    check_ignore(code, ['foo', '*_foo'], ['Foo', 'attr_bar'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tests/test_make_whitelist.py 
new/vulture-1.0/tests/test_make_whitelist.py
--- old/vulture-0.29/tests/test_make_whitelist.py       2018-07-03 
10:46:37.000000000 +0200
+++ new/vulture-1.0/tests/test_make_whitelist.py        2018-08-17 
01:04:57.000000000 +0200
@@ -5,14 +5,12 @@
 
 
 @pytest.fixture
-def check_whitelist(v, capsys):
+def check_whitelist(v):
     def examine(code, results_before, results_after):
         v.scan(code)
         check(v.get_unused_code(), results_before)
-        capsys.readouterr()  # Clear captured text
-        v.make_whitelist()
-        whitelist = capsys.readouterr().out
-        v.scan(whitelist)
+        for item in v.get_unused_code():
+            v.scan(item.get_whitelist_string())
         check(v.get_unused_code(), results_after)
     return examine
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tests/test_report.py 
new/vulture-1.0/tests/test_report.py
--- old/vulture-0.29/tests/test_report.py       2018-07-03 10:49:12.000000000 
+0200
+++ new/vulture-1.0/tests/test_report.py        2018-08-17 01:04:57.000000000 
+0200
@@ -27,9 +27,8 @@
     def test_report(code, expected,  make_whitelist=False):
         filename = 'foo.py'
         v.scan(code, filename=filename)
-        report_func = v.make_whitelist if make_whitelist else v.report
         capsys.readouterr()
-        report_func()
+        v.report(make_whitelist=make_whitelist)
         assert capsys.readouterr().out == expected.format(filename=filename)
     return test_report
 
@@ -54,6 +53,7 @@
 bar  # unused function ({filename}:7)
 _.foobar  # unused attribute ({filename}:8)
 foobar  # unused variable ({filename}:9)
+# unreachable code after 'return' ({filename}:11)
 _.myprop  # unused property ({filename}:13)
 """
     check_report(mock_code, expected, make_whitelist=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tests/test_utils.py 
new/vulture-1.0/tests/test_utils.py
--- old/vulture-0.29/tests/test_utils.py        1970-01-01 01:00:00.000000000 
+0100
+++ new/vulture-1.0/tests/test_utils.py 2018-07-31 14:52:23.000000000 +0200
@@ -0,0 +1,86 @@
+import ast
+
+from . import skip_if_not_has_async
+from vulture import utils
+
+
+def check_decorator_names(code, expected_names):
+    decorator_names = []
+
+    def visit_FunctionDef(node):
+        for decorator in node.decorator_list:
+            decorator_names.append(utils.get_decorator_name(decorator))
+
+    node_visitor = ast.NodeVisitor()
+    node_visitor.visit_AsyncFunctionDef = visit_FunctionDef
+    node_visitor.visit_ClassDef = visit_FunctionDef
+    node_visitor.visit_FunctionDef = visit_FunctionDef
+    node_visitor.visit(ast.parse(code))
+    assert expected_names == decorator_names
+
+
+def test_get_decorator_name_simple():
+    code = """\
+@foobar
+def hoo():
+    pass
+"""
+    check_decorator_names(code, ['@foobar'])
+
+
+def test_get_decorator_name_call():
+    code = """\
+@xyz()
+def bar():
+    pass
+"""
+    check_decorator_names(code, ['@xyz'])
+
+
+@skip_if_not_has_async
+def test_get_decorator_name_async():
+    code = """\
[email protected]('/foobar')
+async def async_function(request):
+    print(reques)
+"""
+    check_decorator_names(code, ['@foo.bar.route'])
+
+
+def test_get_decorator_name_multiple_attrs():
+    code = """\
[email protected]
+def doo():
+    pass
+"""
+    check_decorator_names(code, ['@x.y.z'])
+
+
+def test_get_decorator_name_multiple_attrs_called():
+    code = """\
[email protected]("Foo and Bar")
+def hoofoo():
+    pass
+"""
+    check_decorator_names(code, ['@a.b.c.d.foo'])
+
+
+def test_get_decorator_name_multiple_decorators():
+    code = """\
+@foo
+@bar()
[email protected]('foobar')
+def func():
+    pass
+"""
+    check_decorator_names(code, ['@foo', '@bar', '@x.y.z.a'])
+
+
+def test_get_decorator_name_class():
+    code = """\
+@foo
[email protected]
+class Foo:
+    pass
+"""
+    check_decorator_names(code, ['@foo', '@bar.yz'])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/tox.ini new/vulture-1.0/tox.ini
--- old/vulture-0.29/tox.ini    2018-06-01 22:41:50.000000000 +0200
+++ new/vulture-1.0/tox.ini     2018-08-17 01:04:57.000000000 +0200
@@ -1,5 +1,5 @@
 [tox]
-envlist = cleanup, docs, py27, py34, py35, py36, style
+envlist = cleanup, docs, py27, py34, py35, py36, py37, style
 skip_missing_interpreters = true
 
 # Erase old coverage results, then accumulate them during this tox run.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/vulture/core.py 
new/vulture-1.0/vulture/core.py
--- old/vulture-0.29/vulture/core.py    2018-07-31 14:37:07.000000000 +0200
+++ new/vulture-1.0/vulture/core.py     2018-10-23 18:29:40.000000000 +0200
@@ -38,7 +38,7 @@
 from vulture import lines
 from vulture import utils
 
-__version__ = '0.29'
+__version__ = '1.0'
 
 DEFAULT_CONFIDENCE = 60
 
@@ -63,6 +63,10 @@
     return name.startswith('__') and name.endswith('__')
 
 
+def _match(name, patterns):
+    return any(fnmatchcase(name, pattern) for pattern in patterns)
+
+
 def _is_test_file(filename):
     return any(
         fnmatch(os.path.basename(filename), pattern)
@@ -126,6 +130,16 @@
             utils.format_path(self.filename), self.first_lineno,
             self.message, self.confidence, size_report)
 
+    def get_whitelist_string(self):
+        filename = utils.format_path(self.filename)
+        if self.typ == 'unreachable_code':
+            return ('# {} ({}:{})'.format(
+                self.message, filename, self.first_lineno))
+        else:
+            prefix = '_.' if self.typ in ['attribute', 'property'] else ''
+            return "{}{}  # unused {} ({}:{:d})".format(
+                    prefix, self.name, self.typ, filename, self.first_lineno)
+
     def _tuple(self):
         return (self.filename, self.first_lineno, self.name)
 
@@ -142,7 +156,8 @@
 class Vulture(ast.NodeVisitor):
     """Find dead code."""
 
-    def __init__(self, verbose=False, ignore_names=None):
+    def __init__(self, verbose=False, ignore_names=None,
+                 ignore_decorators=None):
         self.verbose = verbose
 
         def get_list(typ):
@@ -163,6 +178,7 @@
         self.used_names = get_set('name')
 
         self.ignore_names = ignore_names or []
+        self.ignore_decorators = ignore_decorators or []
 
         self.filename = ''
         self.code = []
@@ -256,30 +272,18 @@
         return sorted(confidently_unused,
                       key=by_size if sort_by_size else by_name)
 
-    def make_whitelist(self, min_confidence=0, sort_by_size=False):
-        for item in self.get_unused_code(
-                min_confidence=min_confidence, sort_by_size=sort_by_size):
-            if item.typ != 'unreachable_code':
-                prefix = '_.' if item.typ in ['attribute', 'property'] else ''
-                print("{}{}  # unused {} ({}:{:d})".format(
-                        prefix, item.name, item.typ,
-                        utils.format_path(item.filename), item.first_lineno))
-                self.found_dead_code_or_error = True
-        return self.found_dead_code_or_error
-
-    def report(self, min_confidence=0, sort_by_size=False):
+    def report(self, min_confidence=0, sort_by_size=False,
+               make_whitelist=False):
         """
         Print ordered list of Item objects to stdout.
         """
         for item in self.get_unused_code(
                 min_confidence=min_confidence, sort_by_size=sort_by_size):
-            print(item.get_report(add_size=sort_by_size))
+            print(item.get_whitelist_string() if make_whitelist
+                  else item.get_report(add_size=sort_by_size))
             self.found_dead_code_or_error = True
         return self.found_dead_code_or_error
 
-    def _ignore_name(self, name):
-        return any(fnmatchcase(name, pattern) for pattern in self.ignore_names)
-
     @property
     def unused_classes(self):
         return _get_unused_items(
@@ -353,7 +357,8 @@
                 message='', confidence=DEFAULT_CONFIDENCE, ignore=None):
         last_node = last_node or first_node
         typ = collection.typ
-        if (ignore and ignore(self.filename, name)) or self._ignore_name(name):
+        if (ignore and ignore(self.filename, name)) or _match(
+                name, self.ignore_names):
             self._log('Ignoring {typ} "{name}"'.format(**locals()))
         else:
             first_lineno = first_node.lineno
@@ -384,15 +389,27 @@
             self.used_attrs.add(node.attr)
 
     def visit_ClassDef(self, node):
-        self._define(
-            self.defined_classes, node.name, node, ignore=_ignore_class)
-
-    def visit_FunctionDef(self, node):
         for decorator in node.decorator_list:
-            if getattr(decorator, 'id', None) == 'property':
-                self._define(self.defined_props, node.name, node)
+            if _match(utils.get_decorator_name(decorator),
+                      self.ignore_decorators):
+                self._log('Ignoring class "{}" (decorator whitelisted)'.format(
+                    node.name))
                 break
         else:
+            self._define(
+                self.defined_classes, node.name, node, ignore=_ignore_class)
+
+    def visit_FunctionDef(self, node):
+        decorator_names = [utils.get_decorator_name(
+            decorator) for decorator in node.decorator_list]
+        typ = 'property' if '@property' in decorator_names else 'function'
+        if any(_match(name, self.ignore_decorators)
+               for name in decorator_names):
+            self._log('Ignoring {} "{}" (decorator whitelisted)'.format(
+                    typ, node.name))
+        elif typ == 'property':
+            self._define(self.defined_props, node.name, node)
+        else:
             # Function is not a property.
             self._define(
                 self.defined_funcs, node.name, node,
@@ -518,8 +535,13 @@
     parser.add_argument(
         '--exclude', metavar='PATTERNS', type=csv,
         help='Comma-separated list of paths to ignore (e.g.,'
-        ' "*settings.py,docs/*.py"). {glob_help} A PATTERN without globbing'
-        ' characters is treated as *PATTERN*.'.format(**locals()))
+        ' "*settings.py,docs/*.py"). {glob_help} A PATTERN without glob'
+        ' wildcards is treated as *PATTERN*.'.format(**locals()))
+    parser.add_argument(
+        '--ignore-decorators', metavar='PATTERNS', type=csv,
+        help='Comma-separated list of decorators. Functions and classes using'
+        ' these decorators are ignored (e.g., "@app.route,@require_*").'
+        ' {glob_help}'.format(**locals()))
     parser.add_argument(
         '--ignore-names', metavar='PATTERNS', type=csv, default=None,
         help='Comma-separated list of names to ignore (e.g., "visit_*,do_*").'
@@ -542,10 +564,10 @@
 
 def main():
     args = _parse_args()
-    vulture = Vulture(verbose=args.verbose, ignore_names=args.ignore_names)
+    vulture = Vulture(verbose=args.verbose, ignore_names=args.ignore_names,
+                      ignore_decorators=args.ignore_decorators)
     vulture.scavenge(args.paths, exclude=args.exclude)
-    report_func = (vulture.make_whitelist if args.make_whitelist
-                   else vulture.report)
-    sys.exit(report_func(
+    sys.exit(vulture.report(
         min_confidence=args.min_confidence,
-        sort_by_size=args.sort_by_size))
+        sort_by_size=args.sort_by_size,
+        make_whitelist=args.make_whitelist))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/vulture/utils.py 
new/vulture-1.0/vulture/utils.py
--- old/vulture-0.29/vulture/utils.py   2017-08-28 09:23:30.000000000 +0200
+++ new/vulture-1.0/vulture/utils.py    2018-07-31 14:52:23.000000000 +0200
@@ -56,6 +56,17 @@
     return relpath if not relpath.startswith('..') else path
 
 
+def get_decorator_name(decorator):
+    if isinstance(decorator, ast.Call):
+        decorator = decorator.func
+    parts = []
+    while isinstance(decorator, ast.Attribute):
+        parts.append(decorator.attr)
+        decorator = decorator.value
+    parts.append(decorator.id)
+    return '@' + '.'.join(reversed(parts))
+
+
 def get_modules(paths, toplevel=True):
     """Take files from the command line even if they don't end with .py."""
     modules = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/vulture-0.29/vulture/whitelists/threading_whitelist.py 
new/vulture-1.0/vulture/whitelists/threading_whitelist.py
--- old/vulture-0.29/vulture/whitelists/threading_whitelist.py  1970-01-01 
01:00:00.000000000 +0100
+++ new/vulture-1.0/vulture/whitelists/threading_whitelist.py   2018-10-16 
16:09:59.000000000 +0200
@@ -0,0 +1,5 @@
+import threading
+
+threading.Thread.daemon
+threading.Thread.name
+threading.Thread.run
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/vulture.egg-info/PKG-INFO 
new/vulture-1.0/vulture.egg-info/PKG-INFO
--- old/vulture-0.29/vulture.egg-info/PKG-INFO  2018-07-31 14:37:07.000000000 
+0200
+++ new/vulture-1.0/vulture.egg-info/PKG-INFO   2018-10-23 18:29:40.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: vulture
-Version: 0.29
+Version: 1.0
 Summary: Find dead code
 Home-page: https://github.com/jendrikseipp/vulture
 Author: Jendrik Seipp
@@ -82,13 +82,17 @@
         **Ignoring names**
         
         You can use ``--ignore-names foo*,ba[rz]`` to let Vulture ignore all 
names
-        starting with ``foo`` and the names ``bar`` and ``baz``.
-        
-        We recommend using whitelists instead of ``--ignore-names`` whenever
-        possible, since whitelists are automatically checked for syntactic
-        correctness when passed to Vulture and sometimes you can even pass
-        them to your Python interpreter and let it check that all whitelisted
-        code actually still exists in your project.
+        starting with ``foo`` and the names ``bar`` and ``baz``. Additionally, 
the
+        ``--ignore-decorators`` option can be used to ignore functions 
decorated
+        with the given decorator. This is helpful for example in Flask 
projects,
+        where you can use ``--ignore-decorators "@app.route"`` to ignore all 
functions
+        with the ``@app.route`` decorator.
+        
+        We recommend using whitelists instead of ``--ignore-names`` or
+        ``--ignore-decorators`` whenever possible, since whitelists are 
automatically
+        checked for syntactic correctness when passed to Vulture and often you 
can
+        even pass them to your Python interpreter and let it check that all
+        whitelisted code actually still exists in your project.
         
         **Marking unused variables**
         
@@ -224,9 +228,15 @@
         News
         ====
         
+        1.0 (2018-10-23)
+        ----------------
+        * Add ``--ignore-decorators`` flag (thanks @RJ722).
+        * Add whitelist for ``threading`` module (thanks @andrewhalle).
+        
+        
         0.29 (2018-07-31)
         -----------------
-        * Add ``--ignore-names`` flag for ignoring names matching the given 
glob patterns.
+        * Add ``--ignore-names`` flag for ignoring names matching the given 
glob patterns (thanks @RJ722).
         
         
         0.28 (2018-07-05)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/vulture-0.29/vulture.egg-info/SOURCES.txt 
new/vulture-1.0/vulture.egg-info/SOURCES.txt
--- old/vulture-0.29/vulture.egg-info/SOURCES.txt       2018-07-31 
14:37:07.000000000 +0200
+++ new/vulture-1.0/vulture.egg-info/SOURCES.txt        2018-10-23 
18:29:40.000000000 +0200
@@ -14,7 +14,7 @@
 tests/test_confidence.py
 tests/test_errors.py
 tests/test_format_strings.py
-tests/test_ignore_names.py
+tests/test_ignore.py
 tests/test_imports.py
 tests/test_item.py
 tests/test_make_whitelist.py
@@ -24,6 +24,7 @@
 tests/test_size.py
 tests/test_sorting.py
 tests/test_unreachable.py
+tests/test_utils.py
 vulture/__init__.py
 vulture/__main__.py
 vulture/core.py
@@ -38,5 +39,6 @@
 vulture/whitelists/ast_whitelist.py
 vulture/whitelists/collections_whitelist.py
 vulture/whitelists/sys_whitelist.py
+vulture/whitelists/threading_whitelist.py
 vulture/whitelists/unittest_whitelist.py
 vulture/whitelists/whitelist_utils.py
\ No newline at end of file


Reply via email to