How to use the vulture.utils.get_decorator_name function in vulture

To help you get started, we’ve selected a few vulture examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jendrikseipp / vulture / tests / test_utils.py View on Github external
def visit_FunctionDef(node):
        for decorator in node.decorator_list:
            decorator_names.append(utils.get_decorator_name(decorator))
github jendrikseipp / vulture / vulture / core.py View on Github external
def visit_ClassDef(self, node):
        for decorator in node.decorator_list:
            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)
github jendrikseipp / vulture / vulture / core.py View on Github external
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,
                ignore=_ignore_function)

        # Detect *args and **kwargs parameters. Python 3 recognizes them
        # in visit_Name. For Python 2 we use this workaround. We can't