Coding style.
- Minor shortening of python_gut.
This commit is contained in:
parent
b4b237ec1f
commit
90078f5d32
1 changed files with 1 additions and 5 deletions
|
|
@ -335,15 +335,11 @@ def python_coverage(path):
|
|||
def _function_body_lines(python_source):
|
||||
ranges = []
|
||||
class FuncNodeVisitor(ast.NodeVisitor):
|
||||
|
||||
def _line_range(self, body):
|
||||
return body[0].lineno - 1, body[-1].end_lineno
|
||||
|
||||
def visit_FunctionDef(self, node):
|
||||
ranges.append(self._line_range(node.body))
|
||||
|
||||
def visit_AsyncFunctionDef(self, node):
|
||||
ranges.append(self._line_range(node.body))
|
||||
visit_AsyncFunctionDef = visit_FunctionDef
|
||||
tree = ast.parse(python_source)
|
||||
FuncNodeVisitor().visit(tree)
|
||||
return ranges
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue