summaryrefslogtreecommitdiff
path: root/astroid/builder.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-24 14:47:22 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-05-01 14:18:46 +0200
commitb09100bc50a1a911875ffdefce6307524b613bec (patch)
tree84012c9ab26359396fbf5e5f540133558f81c16a /astroid/builder.py
parent052858174c4e435b77693cb3023ebd8e5c81829f (diff)
downloadastroid-git-b09100bc50a1a911875ffdefce6307524b613bec.tar.gz
Fix a strange construct that seem unnecessary
And probably contribute to the circular import problem.
Diffstat (limited to 'astroid/builder.py')
-rw-r--r--astroid/builder.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/astroid/builder.py b/astroid/builder.py
index de5acac1..5a87c0fe 100644
--- a/astroid/builder.py
+++ b/astroid/builder.py
@@ -18,10 +18,10 @@
The builder is not thread safe and can't be used to parse different sources
at the same time.
"""
-
import os
import textwrap
from tokenize import detect_encoding
+from typing import List, Union
from astroid import (
bases,
@@ -34,6 +34,7 @@ from astroid import (
util,
)
from astroid._ast import get_parser_module
+from astroid.node_classes import NodeNG
objects = util.lazy_import("objects")
@@ -357,7 +358,7 @@ def _find_statement_by_line(node, line):
return None
-def extract_node(code, module_name=""):
+def extract_node(code: str, module_name: str = "") -> Union[NodeNG, List[NodeNG]]:
"""Parses some Python code as a module and extracts a designated AST node.
Statements:
@@ -409,7 +410,6 @@ def extract_node(code, module_name=""):
a module. Will be passed through textwrap.dedent first.
:param str module_name: The name of the module.
:returns: The designated node from the parse tree, or a list of nodes.
- :rtype: astroid.bases.NodeNG, or a list of nodes.
"""
def _extract(node):