VultureChecker/vulture.py

changeset 7
a1a6ff3e5486
parent 1
ea6aed49cd69
child 18
e19e7622a428
--- a/VultureChecker/vulture.py	Tue Oct 06 19:29:52 2015 +0200
+++ b/VultureChecker/vulture.py	Tue Oct 06 20:01:23 2015 +0200
@@ -18,7 +18,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
+#
+#
 # Patched to support the Python 3.5 async functionality.
+# Patched to support PyQt's @pyqtSlot decorator to consider slots as
+# always used.
+# Patches: Copyright (C) 2015 Detlev Offenbach <detlev@die-offenbachs.de>
 #
 
 from __future__ import print_function
@@ -63,6 +68,7 @@
 
         self.defined_attrs = []
         self.defined_funcs = []
+        self.defined_slots = []     # @pyqtSlot support
         self.defined_props = []
         self.defined_vars = []
         self.used_attrs = []
@@ -175,6 +181,11 @@
             if getattr(decorator, 'id', None) == 'property':
                 self.defined_props.append(self._get_item(node, 'property'))
                 break
+            elif getattr(decorator, 'func', None) is not None:
+                # @pyqtSlot support
+                if getattr(getattr(decorator, 'func'), 'id') == 'pyqtSlot':
+                    self.defined_slots.append(self._get_item(node, 'slot'))
+                    break
         else:
             # Function is not a property.
             if not _ignore_function(node.name):

eric ide

mercurial