How to use the vulture.lines 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_size.py View on Github external
def count_lines(node):
    """Estimate the number of lines of the given AST node."""
    last_lineno = lines.get_last_line_number(node)
    assert get_last_line_number_slow(node) == last_lineno
    return last_lineno - node.lineno + 1
github jendrikseipp / vulture / vulture / core.py View on Github external
def _define(self, collection, name, first_node, last_node=None,
                message='', confidence=DEFAULT_CONFIDENCE, ignore=None):
        last_node = last_node or first_node
        typ = collection.typ
        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
            last_lineno = lines.get_last_line_number(last_node)
            collection.append(
                Item(name, typ, self.filename, first_lineno, last_lineno,
                     message=message, confidence=confidence))